mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix calculation of 2**30
In exponent(), 'base *= base;' should not run when base is 65536, since it overflows an int32_t. This also optimizes exponent() based on gcc and clang -O3 test cases in godbolt.org.
This commit is contained in:
@@ -12,7 +12,9 @@ v equs "Y +"
|
||||
ENDM
|
||||
|
||||
test (v 2)*(v 10)**(v 2)*(v 2) == (v 400)
|
||||
test -(v 3)**(v 4) == v -81
|
||||
test -(v 3)**(v 4) == (v -81)
|
||||
test (v 1) << (v 30) == (v $4000_0000)
|
||||
test (v 2)**(v 30) == (v $4000_0000)
|
||||
|
||||
assert DIV(5.0, 2.0) == 2.5
|
||||
assert DIV(-5.0, 2.0) == -2.5
|
||||
|
||||
Reference in New Issue
Block a user