about summary refs log tree commit diff stats
path: root/src/emu/x64runf20f.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-06 11:28:47 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-06 11:28:47 +0200
commit086daef49471bd5f8abecaf618bfdaee50ae729c (patch)
treec47f19e8ef84c5ab786d171d52a63092b3e010ed /src/emu/x64runf20f.c
parent6898df1c862cfdaaa6f3ed502aa7abb79e4accee (diff)
downloadbox64-086daef49471bd5f8abecaf618bfdaee50ae729c.tar.gz
box64-086daef49471bd5f8abecaf618bfdaee50ae729c.zip
Added back some isnan testing to integer conversion (converting a nan, infinite or overflow value to int is UB, and so should be avoided for max cross platform compatibility)
Diffstat (limited to 'src/emu/x64runf20f.c')
-rw-r--r--src/emu/x64runf20f.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/emu/x64runf20f.c b/src/emu/x64runf20f.c
index eb94958d..10da2f09 100644
--- a/src/emu/x64runf20f.c
+++ b/src/emu/x64runf20f.c
@@ -338,12 +338,12 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
                 tmp64s1 = EX->d[1];

                 break;

         }

-        if (tmp64s0==(int32_t)tmp64s0) {

+        if (tmp64s0==(int32_t)tmp64s0 && !isnan(EX->d[0])) {

             GX->sd[0] = (int32_t)tmp64s0;

         } else {

             GX->sd[0] = INT32_MIN;

         }

-        if (tmp64s1==(int32_t)tmp64s1) {

+        if (tmp64s1==(int32_t)tmp64s1 && !isnan(EX->d[1])) {

             GX->sd[1] = (int32_t)tmp64s1;

         } else {

             GX->sd[1] = INT32_MIN;