Added exclusive or operator

This commit is contained in:
ceriel 1987-01-08 14:27:07 +00:00
parent e5820bdbaa
commit 3245258560

View file

@ -80,6 +80,7 @@ char opdesc[] = {
LLDEF, /* EX_INREG */ LLDEF, /* EX_INREG */
LLDEF, /* EX_REGVAR */ LLDEF, /* EX_REGVAR */
LLDEF|RLDEF, /* EX_OR */ LLDEF|RLDEF, /* EX_OR */
LLDEF|RLDEF, /* EX_XOR */
LLDEF|RLDEF, /* EX_AND */ LLDEF|RLDEF, /* EX_AND */
}; };
@ -296,6 +297,10 @@ result_t compute(node) register node_p node; {
assert(leaf1.e_typ == EV_INT && leaf2.e_typ == EV_INT); assert(leaf1.e_typ == EV_INT && leaf2.e_typ == EV_INT);
result.e_v.e_con = leaf1.e_v.e_con | leaf2.e_v.e_con; result.e_v.e_con = leaf1.e_v.e_con | leaf2.e_v.e_con;
return(result); return(result);
case EX_XOR:
assert(leaf1.e_typ == EV_INT && leaf2.e_typ == EV_INT);
result.e_v.e_con = leaf1.e_v.e_con ^ leaf2.e_v.e_con;
return(result);
case EX_AND: case EX_AND:
assert(leaf1.e_typ == EV_INT && leaf2.e_typ == EV_INT); assert(leaf1.e_typ == EV_INT && leaf2.e_typ == EV_INT);
result.e_v.e_con = leaf1.e_v.e_con & leaf2.e_v.e_con; result.e_v.e_con = leaf1.e_v.e_con & leaf2.e_v.e_con;