Beispiel #1
0
        public void execute(PrimitiveInterpretationContext context, ImmutableNodeReferer node)
        {
            long registerIdxA = node.children[1].valueInt;
            long registerIdxB = node.children[2].valueInt;

            // fetch registers
            long valueA = context.registers[registerIdxA].valueInt;
            long valueB = context.registers[registerIdxB].valueInt;

            switch (comparisionType)
            {
            case EnumComparisionType.NEQ_INT:
                context.conditionFlag = valueA != valueB;
                break;

            case EnumComparisionType.EQ_INT:
                context.conditionFlag = valueA == valueB;
                break;

            case EnumComparisionType.G_INT:
                context.conditionFlag = valueA > valueB;
                break;

            case EnumComparisionType.GE_INT:
                context.conditionFlag = valueA >= valueB;
                break;
            }
        }
Beispiel #2
0
        public void execute(PrimitiveInterpretationContext context, ImmutableNodeReferer node)
        {
            Ensure.ensure(node.children.Length >= 1 + 1); // arguments have to be at least   op + target
            int numberOfArgs = node.children.Length - 1 - 1;

            long accumulator = 1;

            for (int argIdx = 0; argIdx < numberOfArgs; argIdx++)
            {
                long registerIdxIteration = node.children[1 + argIdx].valueInt;
                accumulator *= context.registers[registerIdxIteration].valueInt;
            }

            long registerIdxDest = node.children[node.children.Length - 1].valueInt;

            context.registers[registerIdxDest].valueInt = accumulator;

            context.ip++;
        }
Beispiel #3
0
 public void execute(PrimitiveInterpretationContext context, ImmutableNodeReferer node)
 {
     Ensure.ensure(node.children[1].valueInt >= 0);// TODO< ensure >
     context.ip = (int)node.children[1].valueInt;
 }