Skip to content

Commit

Permalink
msvc build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
flyinghead committed Jan 27, 2025
1 parent 3410472 commit 1513c6c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions core/hw/sh4/dyna/shil_canonical.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ shil_opc_end()
//shop_cvt_f2i_t //float to integer : truncate
shil_opc(cvt_f2i_t)

#if HOST_CPU == CPU_X86 || HOST_CPU == CPU_X64
shil_canonical
(
u32,f1,(f32 f1),
Expand All @@ -724,18 +725,29 @@ u32,f1,(f32 f1),
}
else {
res = (s32)f1;
#if HOST_CPU == CPU_X86 || HOST_CPU == CPU_X64
// Fix result sign for Intel CPUs
if ((u32)res == 0x80000000 && f1 > 0)
res = 0x7fffffff;
}
return res;
)
#elif HOST_CPU == CPU_ARM || HOST_CPU == CPU_ARM64
shil_canonical
(
u32,f1,(f32 f1),
s32 res;
if (f1 > 2147483520.0f) { // IEEE 754: 0x4effffff
res = 0x7fffffff;
}
else {
res = (s32)f1;
// conversion of NaN returns 0 on ARM
if (std::isnan(f1))
res = 0x80000000;
#endif
}
return res;
)
#endif

shil_compile
(
Expand Down

0 comments on commit 1513c6c

Please sign in to comment.