File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
main/java/io/github/coderodde/simple/stack/machine
test/java/io/github/coderodde/simple/stack/machine Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -228,10 +228,10 @@ int readWordFromTape(final int address) {
228228 throw new StackMachineException (exceptionMessage );
229229 }
230230
231- final int word0 = Byte .toUnsignedInt (tape [address + 0 ]) << 0 ;
232- final int word1 = Byte .toUnsignedInt (tape [address + 1 ]) << 8 ;
233- final int word2 = Byte .toUnsignedInt (tape [address + 2 ]) << 16 ;
234- final int word3 = Byte .toUnsignedInt (tape [address + 3 ]) << 24 ;
231+ final int word0 = Byte .toUnsignedInt (tape [address + 3 ]) << 0 ;
232+ final int word1 = Byte .toUnsignedInt (tape [address + 2 ]) << 8 ;
233+ final int word2 = Byte .toUnsignedInt (tape [address + 1 ]) << 16 ;
234+ final int word3 = Byte .toUnsignedInt (tape [address + 0 ]) << 24 ;
235235
236236 return word0 |
237237 word1 |
Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ public void printString() {
99 final SimpleStackMachine machine = new SimpleStackMachine ();
1010 final CodeBuilder cb = new CodeBuilder (1000 );
1111
12- cb .emit (Operation .PUSH .getOpcodeByte ());
13- cb .emit (6 );
1412 cb .emit (Operation .PUSH .getOpcodeByte ());
1513 cb .emit (900 );
14+ cb .emit (Operation .PUSH .getOpcodeByte ());
15+ cb .emit (6 );
1616 cb .emit (Operation .PRINT_STRING .getOpcodeByte ());
1717 cb .emit (Operation .HALT .getOpcodeByte ());
1818 cb .emit ("Hello!" , 900 );
You can’t perform that action at this time.
0 commit comments