summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FloatUtils.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2024-05-04 08:24:59 +0100
committerGitHub <noreply@github.com>2024-05-04 08:24:59 +0100
commitc442c0d5e5dc993562b43871a7548d64bc82a1ad (patch)
treef8d0e97e62b7212788ef1d121598e160fb163662 /Source/Core/Common/FloatUtils.cpp
parentc23562b7b5f43d27dab62ce6e3a25a2c3c35aed4 (diff)
parentfbbfea8e8e536800a6a911eb90cecdd1f343f9e3 (diff)
Merge pull request #10957 from Pokechu22/std-bitcast
Replace Common::BitCast with std::bit_cast
Diffstat (limited to 'Source/Core/Common/FloatUtils.cpp')
-rw-r--r--Source/Core/Common/FloatUtils.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/Source/Core/Common/FloatUtils.cpp b/Source/Core/Common/FloatUtils.cpp
index dbe2a0b508..a671eb278c 100644
--- a/Source/Core/Common/FloatUtils.cpp
+++ b/Source/Core/Common/FloatUtils.cpp
@@ -3,15 +3,14 @@
#include "Common/FloatUtils.h"
+#include <bit>
#include <cmath>
-#include "Common/BitUtils.h"
-
namespace Common
{
u32 ClassifyDouble(double dvalue)
{
- const u64 ivalue = BitCast<u64>(dvalue);
+ const u64 ivalue = std::bit_cast<u64>(dvalue);
const u64 sign = ivalue & DOUBLE_SIGN;
const u64 exp = ivalue & DOUBLE_EXP;
@@ -43,7 +42,7 @@ u32 ClassifyDouble(double dvalue)
u32 ClassifyFloat(float fvalue)
{
- const u32 ivalue = BitCast<u32>(fvalue);
+ const u32 ivalue = std::bit_cast<u32>(fvalue);
const u32 sign = ivalue & FLOAT_SIGN;
const u32 exp = ivalue & FLOAT_EXP;
@@ -86,7 +85,7 @@ const std::array<BaseAndDec, 32> frsqrte_expected = {{
double ApproximateReciprocalSquareRoot(double val)
{
- s64 integral = BitCast<s64>(val);
+ s64 integral = std::bit_cast<s64>(val);
s64 mantissa = integral & ((1LL << 52) - 1);
const s64 sign = integral & (1ULL << 63);
s64 exponent = integral & (0x7FFLL << 52);
@@ -136,7 +135,7 @@ double ApproximateReciprocalSquareRoot(double val)
const auto& entry = frsqrte_expected[i / 2048];
integral |= static_cast<s64>(entry.m_base + entry.m_dec * (i % 2048)) << 26;
- return BitCast<double>(integral);
+ return std::bit_cast<double>(integral);
}
const std::array<BaseAndDec, 32> fres_expected = {{
@@ -152,7 +151,7 @@ const std::array<BaseAndDec, 32> fres_expected = {{
// Used by fres and ps_res.
double ApproximateReciprocal(double val)
{
- s64 integral = BitCast<s64>(val);
+ s64 integral = std::bit_cast<s64>(val);
const s64 mantissa = integral & ((1LL << 52) - 1);
const s64 sign = integral & (1ULL << 63);
s64 exponent = integral & (0x7FFLL << 52);
@@ -184,7 +183,7 @@ double ApproximateReciprocal(double val)
integral = sign | exponent;
integral |= static_cast<s64>(entry.m_base - (entry.m_dec * (i % 1024) + 1) / 2) << 29;
- return BitCast<double>(integral);
+ return std::bit_cast<double>(integral);
}
} // namespace Common