From 7f160cfd028d2015ff2bdf967a2643a2611a9b63 Mon Sep 17 00:00:00 2001 From: Vladimir <75939896+VladimirMirMir@users.noreply.github.com> Date: Tue, 9 Feb 2021 22:00:39 +0300 Subject: [PATCH] Small update Small update on one method. --- Assets/Patterns/10. Bytecode/Scripts/VM.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Assets/Patterns/10. Bytecode/Scripts/VM.cs b/Assets/Patterns/10. Bytecode/Scripts/VM.cs index 86c28a9..303af32 100644 --- a/Assets/Patterns/10. Bytecode/Scripts/VM.cs +++ b/Assets/Patterns/10. Bytecode/Scripts/VM.cs @@ -47,13 +47,14 @@ public void Interpret(int[] bytecode) } case Instruction.INST_LITERAL: { - //Important that this i++ is not inside bytecode[i++] or it will not jump to next i - i++; - - int value = bytecode[i]; - - Push(value); + ////Important that this i++ is not inside bytecode[i++] or it will not jump to next i + //i++; + //int value = bytecode[i]; + //Push(value); + //this can be a oneliner + //in this case bytecode will use i+1 bytecode element + Push(bytecode[++i]); break; } case Instruction.INST_GET_HEALTH: