diff options
author | Remy Oukaour <remy.oukaour@gmail.com> | 2018-01-16 17:27:50 -0500 |
---|---|---|
committer | Remy Oukaour <remy.oukaour@gmail.com> | 2018-01-16 17:27:50 -0500 |
commit | 7b3de85a06e81d14ac0c73e8f9e1ab8e4a474beb (patch) | |
tree | 6ffeacd670c9ff66a951550a15a0e990f88ab75d /macros/code.asm | |
parent | 80480821142d7a7b16dd2b1a98a213e7b389af0f (diff) |
Avoid "+- 1" at every maskbits
Diffstat (limited to 'macros/code.asm')
-rw-r--r-- | macros/code.asm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/macros/code.asm b/macros/code.asm index 6e9c378e3..799c27d45 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -37,17 +37,17 @@ ENDM maskbits: MACRO ; masks just enough bits to cover the argument -; e.g. "maskbits %00010100" becomes "and %00011111" +; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001) ; example usage in rejection sampling: ; .loop ; call Random -; maskbits 30 +- 1 +; maskbits 30 ; cp 30 ; jr nc, .loop x = 1 rept 8 -if x < (\1) -x = (x + 1) * 2 +- 1 +if x + 1 < (\1) +x = x << 1 | 1 endc endr and x |