From dac9c1e52c931fa540ed0849ba31e1486ecc427d Mon Sep 17 00:00:00 2001 From: joevt Date: Mon, 5 Feb 2024 06:12:48 -0800 Subject: [PATCH] ppcfpopcodes: Fix fctiw* round to nearest. 0.3 should not round up to 1. --- cpu/ppc/ppcfpopcodes.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cpu/ppc/ppcfpopcodes.cpp b/cpu/ppc/ppcfpopcodes.cpp index af21f12..c9a095e 100644 --- a/cpu/ppc/ppcfpopcodes.cpp +++ b/cpu/ppc/ppcfpopcodes.cpp @@ -123,11 +123,7 @@ inline void ppc_update_cr1() { } int32_t round_to_nearest(double f) { - if (f >= 0.0) { - return static_cast(static_cast (std::ceil(f))); - } else { - return static_cast(static_cast (std::floor(f))); - } + return static_cast(static_cast (std::floor(f + 0.5))); } void set_host_rounding_mode(uint8_t mode) {