Added exclusive or operator
This commit is contained in:
parent
e5820bdbaa
commit
3245258560
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue