mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-25 04:22:07 +00:00
Remove undefined behavior from shifts
`asl` and `asr` in `src/link/patch.c` courtesy of @pinobatch, and rearranged in RGBASM evaluators.
This commit is contained in:
27
test/asm/shift.asm
Normal file
27
test/asm/shift.asm
Normal file
@@ -0,0 +1,27 @@
|
||||
test: macro
|
||||
; Test the rpn system, as well as the linker...
|
||||
dl \1 + zero
|
||||
|
||||
; ...as well as the constexpr system
|
||||
result\@ equ \1
|
||||
printt "\1 = {result\@}\n"
|
||||
endm
|
||||
|
||||
section "test", ROM0[0]
|
||||
|
||||
test 1 << 1
|
||||
test 1 << 32
|
||||
test 1 << 9001
|
||||
test -1 << 1
|
||||
test -1 << 32
|
||||
test -1 << -9001
|
||||
|
||||
test -1 >> 1
|
||||
test -1 >> 32
|
||||
test -1 >> 9001
|
||||
test -4 >> 1
|
||||
test -4 >> 2
|
||||
test -1 >> -9001
|
||||
|
||||
SECTION "Zero", ROM0[0]
|
||||
zero:
|
||||
Reference in New Issue
Block a user