From c7cd1424f4e2cd4452461c6230c8b22bb7fe423b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 16 May 2018 17:44:45 -0400 Subject: [PATCH] Interpreter_FPUtils: Use Common::BitCast where applicable Gets rid of now-unnecessary memcpy boilerplating for different bit representations between integral and fp types. --- .../PowerPC/Interpreter/Interpreter_FPUtils.h | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h index 593dc10bbb..d6ff00356a 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -5,9 +5,9 @@ #pragma once #include -#include #include +#include "Common/BitUtils.h" #include "Common/CPUDetect.h" #include "Common/CommonTypes.h" #include "Common/FloatUtils.h" @@ -73,28 +73,18 @@ inline double ForceDouble(double d) inline double Force25Bit(double d) { - u64 integral; - std::memcpy(&integral, &d, sizeof(u64)); + u64 integral = Common::BitCast(d); integral = (integral & 0xFFFFFFFFF8000000ULL) + (integral & 0x8000000); - double result; - std::memcpy(&result, &integral, sizeof(double)); - - return result; + return Common::BitCast(integral); } inline double MakeQuiet(double d) { - u64 integral; - std::memcpy(&integral, &d, sizeof(u64)); + const u64 integral = Common::BitCast(d) | Common::DOUBLE_QBIT; - integral |= Common::DOUBLE_QBIT; - - double result; - std::memcpy(&result, &integral, sizeof(double)); - - return result; + return Common::BitCast(integral); } // these functions allow globally modify operations behaviour