From 7214b08f813367133696d1052da9d791fad6b3c3 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Fri, 23 Jul 2021 00:40:28 +0200 Subject: [PATCH] UserspaceEmulator: Simplify the definition of the FPU register stack Long doubles are always at least 80 bits wide in memory and it suffices if we can address these 80 bits, to mark the long double as NAN at the end of an MMX instruction, so the additional magic using conditional types is unnecessary. --- Userland/DevTools/UserspaceEmulator/SoftFPU.cpp | 5 ++--- Userland/DevTools/UserspaceEmulator/SoftFPU.h | 7 +------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp index 6d8eb1fc86..54cbf02d09 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp @@ -93,11 +93,10 @@ ALWAYS_INLINE MMX SoftFPU::mmx_get(u8 index) const ALWAYS_INLINE void SoftFPU::mmx_set(u8 index, MMX value) { m_storage[index].mmx = value; - // The high bytes are set to 0b11... to make the floatingpoint value NaN. + // The high bytes are set to 0b11... to make the floating-point value NaN. // This way we are technically able to find out if we are reading the wrong // type, but this is still difficult, so we use our own lookup for that - // We set the alignment bytes to all 1's, too, just in case - m_storage[index].__high = ~(decltype(m_storage[index].__high))0u; + m_storage[index].__high = 0xFFFFU; m_reg_is_mmx[index] = true; } diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.h b/Userland/DevTools/UserspaceEmulator/SoftFPU.h index c9376b9849..f02f83f5e7 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.h +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.h @@ -289,12 +289,7 @@ private: long double fp; struct { MMX mmx; - Conditional> - __high; + u16 __high; }; } m_storage[8];