diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2022-08-05 21:10:17 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2024-05-03 18:43:51 -0700 |
| commit | fbbfea8e8e536800a6a911eb90cecdd1f343f9e3 (patch) | |
| tree | e591d19127ac8cea60acf1108a6273dba6111558 /Source/Core/Common/FloatUtils.cpp | |
| parent | 57c890d4fcec1b86d71a8a5ad9c51c548a7bd9cd (diff) | |
Replace Common::BitCast with std::bit_cast
Diffstat (limited to 'Source/Core/Common/FloatUtils.cpp')
| -rw-r--r-- | Source/Core/Common/FloatUtils.cpp | 15 |
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 |
