An Amulet compiler patch causes this to not crash.
This commit is contained in:
parent
4852cffa0a
commit
ce17f86c41
9 changed files with 3283 additions and 488 deletions
31
mem/int.ml
31
mem/int.ml
|
@ -24,8 +24,8 @@ instance decode s8 begin
|
|||
let decode addr =
|
||||
let u8 = Dolphin.read_value_8 addr
|
||||
let signfix =
|
||||
if u8 > 127 then
|
||||
negate (256 - u8)
|
||||
if u8 > 0xFF then
|
||||
negate (0x100 - u8)
|
||||
else
|
||||
u8
|
||||
S8 signfix
|
||||
|
@ -53,8 +53,8 @@ instance decode s16 begin
|
|||
let decode addr =
|
||||
let u16 = Dolphin.read_value_16 addr
|
||||
let signfix =
|
||||
if u16 > 32767 then
|
||||
negate (65536 - u16)
|
||||
if u16 > 0xFFFF then
|
||||
negate (0x10000 - u16)
|
||||
else
|
||||
u16
|
||||
S16 signfix
|
||||
|
@ -67,15 +67,24 @@ instance show u32 begin
|
|||
let show (U32 x) = (show x) ^ "_u32"
|
||||
end
|
||||
|
||||
instance decode u32 begin
|
||||
let decode addr = U32 (Dolphin.read_value_32 addr)
|
||||
end
|
||||
|
||||
type s32 =
|
||||
S32 of int
|
||||
|
||||
instance show s32 begin
|
||||
let show (S32 x) =
|
||||
let signfix =
|
||||
if x > 2147483647 then
|
||||
negate (4294967296 - x)
|
||||
else
|
||||
x
|
||||
(show signfix) ^ "_s32"
|
||||
let show (S32 x) = (show x) ^ "_s32"
|
||||
end
|
||||
|
||||
instance decode s32 begin
|
||||
let decode addr =
|
||||
let u32 = Dolphin.read_value_32 addr
|
||||
let signfix =
|
||||
if u32 > 0xFFFFFFFF then
|
||||
negate (0x100000000 - u32)
|
||||
else
|
||||
u32
|
||||
S32 signfix
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue