From db568b8658b8c0ebc08efea6796bf37a133fa5c7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 7 May 2023 22:59:18 +0200 Subject: [PATCH] Correct the floatx80_abs() and floatx80_chs() declarations when used with C++ code - fixes the sign in some trigonometric instruction, fixes Quake on SoftFloat. --- src/cpu/softfloat/softfloatx80.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cpu/softfloat/softfloatx80.h b/src/cpu/softfloat/softfloatx80.h index 8378169e2..1f96141b4 100644 --- a/src/cpu/softfloat/softfloatx80.h +++ b/src/cpu/softfloat/softfloatx80.h @@ -80,7 +80,11 @@ int floatx80_compare_quiet(floatx80 a, floatx80 b, struct float_status_t *status | for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ +#ifdef __cplusplus +BX_CPP_INLINE floatx80& floatx80_abs(floatx80 ®) +#else BX_CPP_INLINE floatx80 floatx80_abs(floatx80 reg) +#endif { reg.exp &= 0x7FFF; return reg; @@ -92,7 +96,11 @@ BX_CPP_INLINE floatx80 floatx80_abs(floatx80 reg) | Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ +#ifdef __cplusplus +BX_CPP_INLINE floatx80& floatx80_chs(floatx80 ®) +#else BX_CPP_INLINE floatx80 floatx80_chs(floatx80 reg) +#endif { reg.exp ^= 0x8000; return reg;