summaryrefslogtreecommitdiff
path: root/macros/code.asm
diff options
context:
space:
mode:
authorsurskitty <surskitty@gmail.com>2018-01-23 00:02:56 -0500
committersurskitty <surskitty@gmail.com>2018-01-23 00:02:56 -0500
commitfbc6fe4722f3faa69f4126ea3d2fe3a41fcba16d (patch)
tree98c4ff39e6cb5a310c8184ba7634ef5eb7cfd19e /macros/code.asm
parent4162705db909da94a62f30b5e2caee048b3bc107 (diff)
parentc60f1331fef22b886adf3472d2b4f348832cfaf7 (diff)
Merge branch 'master' of github.com:pret/pokecrystal
Diffstat (limited to 'macros/code.asm')
-rw-r--r--macros/code.asm9
1 files changed, 4 insertions, 5 deletions
diff --git a/macros/code.asm b/macros/code.asm
index 5ec214d50..799c27d45 100644
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -35,10 +35,9 @@ jumptable: MACRO
jp hl
ENDM
-; Many mobile functions were dummied out in localization.
-mobile EQUS "ret"
-
maskbits: MACRO
+; masks just enough bits to cover the argument
+; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001)
; example usage in rejection sampling:
; .loop
; call Random
@@ -47,8 +46,8 @@ maskbits: MACRO
; jr nc, .loop
x = 1
rept 8
-if \1 > x
-x = (x + 1) * 2 +- 1
+if x + 1 < (\1)
+x = x << 1 | 1
endc
endr
and x