Switching to JSValue throughout. Implementing operators per base type.
git-svn-id: svn://10.0.0.236/trunk@32415 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -7,26 +7,27 @@ class BitwiseNode extends BinaryNode {
|
||||
|
||||
void eval(Environment theEnv)
|
||||
{
|
||||
super.eval(theEnv);
|
||||
int iR = (int)(theEnv.theStack.pop().d);
|
||||
int iL = (int)(theEnv.theStack.pop().d);
|
||||
left.eval(theEnv);
|
||||
JSInteger lV = theEnv.theStack.pop().toJSInteger();
|
||||
right.eval(theEnv);
|
||||
|
||||
if (op == "&")
|
||||
theEnv.theStack.push(new StackValue(iL & iR));
|
||||
lV.and(theEnv);
|
||||
else
|
||||
if (op == "|")
|
||||
theEnv.theStack.push(new StackValue(iL | iR));
|
||||
lV.or(theEnv);
|
||||
else
|
||||
if (op == "^")
|
||||
theEnv.theStack.push(new StackValue(iL ^ iR));
|
||||
lV.xor(theEnv);
|
||||
else
|
||||
if (op == "<<")
|
||||
theEnv.theStack.push(new StackValue(iL << iR));
|
||||
lV.shr(theEnv);
|
||||
else
|
||||
if (op == ">>")
|
||||
theEnv.theStack.push(new StackValue(iL >> iR));
|
||||
lV.shl(theEnv);
|
||||
else
|
||||
if (op == ">>>")
|
||||
theEnv.theStack.push(new StackValue(iL >>> iR));
|
||||
lV.ushl(theEnv);
|
||||
else
|
||||
System.out.println("missing bitwise op " + op);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user