mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Meta: Don't roundtrip floats for i64/i32 hex literals in wasm tests
This commit is contained in:
parent
c6a137dbac
commit
799471d16f
1 changed files with 10 additions and 3 deletions
|
@ -238,6 +238,16 @@ def genarg(spec):
|
||||||
|
|
||||||
def gen():
|
def gen():
|
||||||
x = spec['value']
|
x = spec['value']
|
||||||
|
if spec['type'] in ('i32', 'i64'):
|
||||||
|
if x.startswith('0x'):
|
||||||
|
if spec['type'] == 'i32':
|
||||||
|
# cast back to i32 to get the correct sign
|
||||||
|
return str(struct.unpack('>i', struct.pack('>Q', int(x, 16))[4:])[0])
|
||||||
|
|
||||||
|
# cast back to i64 to get the correct sign
|
||||||
|
return str(struct.unpack('>q', struct.pack('>Q', int(x, 16)))[0])
|
||||||
|
return x
|
||||||
|
|
||||||
if x == 'nan':
|
if x == 'nan':
|
||||||
return 'NaN'
|
return 'NaN'
|
||||||
if x == '-nan':
|
if x == '-nan':
|
||||||
|
@ -274,9 +284,6 @@ def genarg(spec):
|
||||||
if x.startswith('-nan'):
|
if x.startswith('-nan'):
|
||||||
return '-NaN'
|
return '-NaN'
|
||||||
return x
|
return x
|
||||||
if spec['type'] == 'i32':
|
|
||||||
# cast back to i32 to get the correct sign
|
|
||||||
return str(struct.unpack('>i', struct.pack('>q', int(x))[4:])[0])
|
|
||||||
return str(x)
|
return str(x)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue