use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class DDiv method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext two = stack.pop();
StackContext one = stack.pop();
ins.pop(two, one);
Value result = Value.UNKNOWN;
if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull()) {
double d2 = (double) two.getValue().getValue(), d1 = (double) one.getValue().getValue();
if (d2 != 0.0d)
result = new Value(d1 / d2);
}
StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class DLoad method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
Variables variables = frame.getVariables();
VariableContext vctx = variables.get(index);
assert vctx.getType().equals(Type.DOUBLE);
ins.read(vctx);
StackContext ctx = new StackContext(ins, vctx);
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class DMul method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext two = stack.pop();
StackContext one = stack.pop();
ins.pop(two, one);
Value result = Value.UNKNOWN;
if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull()) {
double d2 = (double) two.getValue().getValue(), d1 = (double) one.getValue().getValue();
result = new Value(d1 * d2);
}
StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class DNeg method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext value = stack.pop();
ins.pop(value);
Value result = Value.UNKNOWN;
if (!value.getValue().isUnknownOrNull()) {
double d = (double) value.getValue().getValue();
result = new Value(-d);
}
StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
stack.push(ctx);
ins.push(ctx);
return ins;
}
use of net.runelite.asm.execution.StackContext in project runelite by runelite.
the class DRem method execute.
@Override
public InstructionContext execute(Frame frame) {
InstructionContext ins = new InstructionContext(this, frame);
Stack stack = frame.getStack();
StackContext two = stack.pop();
StackContext one = stack.pop();
ins.pop(two, one);
Value result = Value.UNKNOWN;
if (!two.getValue().isUnknownOrNull() && !one.getValue().isUnknownOrNull()) {
double d2 = (double) two.getValue().getValue(), d1 = (double) one.getValue().getValue();
if (d2 != 0.0d)
result = new Value(d1 % d2);
}
StackContext ctx = new StackContext(ins, Type.DOUBLE, result);
stack.push(ctx);
ins.push(ctx);
return ins;
}
Aggregations