Added bitwise and and or operators
This commit is contained in:
parent
01ac83b971
commit
ceee24a4cd
1 changed files with 10 additions and 0 deletions
|
@ -79,6 +79,8 @@ char opdesc[] = {
|
|||
0, /* EX_HIGHW */
|
||||
LLDEF, /* EX_INREG */
|
||||
LLDEF, /* EX_REGVAR */
|
||||
LLDEF|RLDEF, /* EX_OR */
|
||||
LLDEF|RLDEF, /* EX_AND */
|
||||
};
|
||||
|
||||
string salloc(),strcpy(),strcat();
|
||||
|
@ -290,6 +292,14 @@ result_t compute(node) register node_p node; {
|
|||
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_OR:
|
||||
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:
|
||||
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_TIMES:
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue