diff options
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64rundd.c | 9 | ||||
| -rw-r--r-- | src/emu/x64rundf.c | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/emu/x64rundd.c b/src/emu/x64rundd.c index f33450a7..fc65f01d 100644 --- a/src/emu/x64rundd.c +++ b/src/emu/x64rundd.c @@ -125,7 +125,14 @@ uintptr_t RunDD(x64emu_t *emu, rex_t rex, uintptr_t addr) break; case 1: /* FISTTP ED qword */ GETE8(0); - *(int64_t*)ED = ST0.d; + if(STll(0).sref==ST(0).sq) + ED->sq[0] = STll(0).sq; + else { + if(isgreater(ST0.d, (double)0x7fffffffffffffffLL) || isless(ST0.d, -(double)0x8000000000000000LL) || !isfinite(ST0.d)) + *(uint64_t*)ED = 0x8000000000000000LL; + else + *(int64_t*)ED = ST0.d; + } fpu_do_pop(emu); break; case 2: /* FST double */ diff --git a/src/emu/x64rundf.c b/src/emu/x64rundf.c index 528a6c3f..d707863c 100644 --- a/src/emu/x64rundf.c +++ b/src/emu/x64rundf.c @@ -175,7 +175,7 @@ uintptr_t RunDF(x64emu_t *emu, rex_t rex, uintptr_t addr) if(STll(0).sref==ST(0).sq) ED->sq[0] = STll(0).sq; else { - if(isgreater(ST0.d, (double)(int64_t)0x7fffffffffffffffLL) || isless(ST0.d, (double)(int64_t)0x8000000000000000LL) || !isfinite(ST0.d)) + if(isgreater(ST0.d, (double)0x7fffffffffffffffLL) || isless(ST0.d, -(double)0x8000000000000000LL) || !isfinite(ST0.d)) ED->sq[0] = 0x8000000000000000LL; else ED->sq[0] = fpu_round(emu, ST0.d); |