Skip to content

Commit

Permalink
fixed abs constfold (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismypassport committed Apr 22, 2024
1 parent 2a04b55 commit 60c93d6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pico_constfold.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def lua_neg(a):

def lua_abs(a):
if a.is_number() and a.value != 0x80000000: # avoid relying on clamping overflow behavior
return LuaNumber(abs(a.value))
return LuaNumber(abs(fixnum_to_signed(a.value)))

def lua_floor(a):
if a.is_number():
Expand Down
2 changes: 1 addition & 1 deletion shrinko8.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pico_defs import get_default_version_id
import argparse

k_version = 'v1.2.0d'
k_version = 'v1.2.0e'

def SplitBySeps(val):
return k_hint_split_re.split(val)
Expand Down
4 changes: 2 additions & 2 deletions test_compare/const.p8
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ stop() -- for pure syntax check
?-nil
-- abs
?1.3
?65534.70002
?32768.00002
?1.3
?32767.99999
?abs(0x8000)
-- flr
?5
Expand Down
4 changes: 2 additions & 2 deletions test_compare/constmin.p8
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ stop()?0
?-false
?-nil
?1.3
?-1.3
?32768.00002
?1.3
?32767.99999
?abs(32768)
?5
?5
Expand Down

0 comments on commit 60c93d6

Please sign in to comment.