Skip to content

Commit 7f160cf

Browse files
Small update
Small update on one method.
1 parent e35fd19 commit 7f160cf

File tree

1 file changed

+7
-6
lines changed
  • Assets/Patterns/10. Bytecode/Scripts

1 file changed

+7
-6
lines changed

Assets/Patterns/10. Bytecode/Scripts/VM.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ public void Interpret(int[] bytecode)
4747
}
4848
case Instruction.INST_LITERAL:
4949
{
50-
//Important that this i++ is not inside bytecode[i++] or it will not jump to next i
51-
i++;
52-
53-
int value = bytecode[i];
54-
55-
Push(value);
50+
////Important that this i++ is not inside bytecode[i++] or it will not jump to next i
51+
//i++;
52+
//int value = bytecode[i];
53+
//Push(value);
5654

55+
//this can be a oneliner
56+
//in this case bytecode will use i+1 bytecode element
57+
Push(bytecode[++i]);
5758
break;
5859
}
5960
case Instruction.INST_GET_HEALTH:

0 commit comments

Comments
 (0)