@@ -54,17 +54,21 @@ Next, here is a list of all types of bytecode instructions it supports.
5454 associated with the same ` <name> ` .
5555 Such a ` LABEL ` line is guaranteed to exist such that any ` JUMP ` is valid,
5656 and that exactly * one* line will match, making this instruction always unambiguous.
57- * ` ADD <value> <value> ` : Add the two ` <value> ` s and push the result on the top of the ** stack** .
58- * ` SUB <value> <value> ` : Subtract the second ` <value> ` from the first ` <value> `
57+ * ` ADD <value> <value> ` : Add the two ` <value> ` s, take its modulo of ` 10^9 + 7 ` ,
5958 and push the result on the top of the ** stack** .
60- * ` MUL <value> <value> ` : Multiply the two ` <value> ` s together
59+ * ` SUB <value> <value> ` : Subtract the second ` <value> ` from the first ` <value> ` ,
60+ take its modulo of ` 10^9 + 7 ` ,
61+ and push the result on the top of the ** stack** .
62+ * ` MUL <value> <value> ` : Multiply the two ` <value> ` s together,
63+ take its modulo of ` 10^9 + 7 ` ,
6164 and push the result on the top of the ** stack** .
6265* ` DIVMOD <value> <value> ` : Conduct a division of the first ` <value> ` by the second ` <value> ` .
6366 First push the quotient of the division onto the ** stack** ,
6467 then push the remainder (modulo) of the division onto the ** stack** .
6568 If, however, the second ` <value> ` is zero, then instead of the quotient and remainder,
6669 push the original ` <value> ` s onto the ** stack** instead.
6770 (i.e., push the first ` <value> ` first, then the second ` <value> ` next.)
71+ In both cases, both values being pushed onto the ** stack** are modulo'd by ` 10^9 + 7 ` .
6872* ` CMP <value> <value> ` : Compares the first ` <value> ` against the second ` <value> ` .
6973 If the two are equal, push ` 0 ` onto the ** stack** .
7074 If the first is greater than the second, push ` 1 ` onto the ** stack** .
@@ -113,7 +117,7 @@ The following instructions will be executed:
1131175 . ` LOAD 2 ` : Loads the value ` 2 ` onto the stack.
1141186 . ` STORE ! ` : Pops ` 2 ` from the stack, stores it in the output register.
1151197 . ` ADD a ! ` : Adds the values of the variable ` a ` and the output register,
116- which is ` 6 + 2 = 8 ` . Hence, ` 8 ` is loaded onto the stack.
120+ which is ` 6 + 2 = 8 ` . Hence, ` 8 % (10^9 + 7) = 8 ` is loaded onto the stack.
1171218 . ` STORE b ` : Pops ` 8 ` from the stack, stores it in the variable ` b ` .
1181229 . ` BRANCHCMP b 8 EQ pqr ` : Compares the variable ` b ` with the value ` 8 ` .
119123 Since they are equal in value, jump to the line that reads ` LABEL pqr ` (second from top).
0 commit comments