summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-05-16 17:44:45 -0400
committerLioncash <mathew1800@gmail.com>2018-05-16 17:48:30 -0400
commitc7cd1424f4e2cd4452461c6230c8b22bb7fe423b (patch)
tree603ea488a2e87ead3b42d21a3f4b3c5c86b5df48 /Source/Core
parentb547f72878f954ca030c7a6d6672ee676a57eba4 (diff)
Interpreter_FPUtils: Use Common::BitCast where applicable
Gets rid of now-unnecessary memcpy boilerplating for different bit representations between integral and fp types.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h20
1 files 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 <cmath>
-#include <cstring>
#include <limits>
+#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<u64>(d);
integral = (integral & 0xFFFFFFFFF8000000ULL) + (integral & 0x8000000);
- double result;
- std::memcpy(&result, &integral, sizeof(double));
-
- return result;
+ return Common::BitCast<double>(integral);
}
inline double MakeQuiet(double d)
{
- u64 integral;
- std::memcpy(&integral, &d, sizeof(u64));
-
- integral |= Common::DOUBLE_QBIT;
-
- double result;
- std::memcpy(&result, &integral, sizeof(double));
+ const u64 integral = Common::BitCast<u64>(d) | Common::DOUBLE_QBIT;
- return result;
+ return Common::BitCast<double>(integral);
}
// these functions allow globally modify operations behaviour