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/VideoCommon | |
| parent | 57c890d4fcec1b86d71a8a5ad9c51c548a7bd9cd (diff) | |
Replace Common::BitCast with std::bit_cast
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/BPMemory.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoaderBase.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/XFStructs.cpp | 31 |
3 files changed, 20 insertions, 19 deletions
diff --git a/Source/Core/VideoCommon/BPMemory.cpp b/Source/Core/VideoCommon/BPMemory.cpp index 67952dc1ed..acf26e80c4 100644 --- a/Source/Core/VideoCommon/BPMemory.cpp +++ b/Source/Core/VideoCommon/BPMemory.cpp @@ -3,7 +3,7 @@ #include "VideoCommon/BPMemory.h" -#include "Common/BitUtils.h" +#include <bit> // BP state // STATE_TO_SAVE @@ -50,14 +50,14 @@ float FogParam0::FloatValue() const { // scale mantissa from 11 to 23 bits const u32 integral = (sign << 31) | (exp << 23) | (mant << 12); - return Common::BitCast<float>(integral); + return std::bit_cast<float>(integral); } float FogParam3::FloatValue() const { // scale mantissa from 11 to 23 bits const u32 integral = (c_sign << 31) | (c_exp << 23) | (c_mant << 12); - return Common::BitCast<float>(integral); + return std::bit_cast<float>(integral); } float FogParams::GetA() const diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp index 11ac3833c7..40c82145b0 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.cpp +++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp @@ -113,7 +113,7 @@ public: // Some games (e.g. Donkey Kong Country Returns) have a few draws that contain NaN. // Since NaN != NaN, we need to compare the bits instead. const auto bit_equal = [](float val_a, float val_b) { - return Common::BitCast<u32>(val_a) == Common::BitCast<u32>(val_b); + return std::bit_cast<u32>(val_a) == std::bit_cast<u32>(val_b); }; // The last element is allowed to be garbage for SIMD overwrites. diff --git a/Source/Core/VideoCommon/XFStructs.cpp b/Source/Core/VideoCommon/XFStructs.cpp index 33f47a01a5..e5ca9b81ea 100644 --- a/Source/Core/VideoCommon/XFStructs.cpp +++ b/Source/Core/VideoCommon/XFStructs.cpp @@ -3,7 +3,8 @@ #include "VideoCommon/XFStructs.h" -#include "Common/BitUtils.h" +#include <bit> + #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/Swap.h" @@ -379,42 +380,42 @@ std::pair<std::string, std::string> GetXFRegInfo(u32 address, u32 value) case XFMEM_SETVIEWPORT: return std::make_pair(RegName(XFMEM_SETVIEWPORT + 0), - fmt::format("Viewport width: {}", Common::BitCast<float>(value))); + fmt::format("Viewport width: {}", std::bit_cast<float>(value))); case XFMEM_SETVIEWPORT + 1: return std::make_pair(RegName(XFMEM_SETVIEWPORT + 1), - fmt::format("Viewport height: {}", Common::BitCast<float>(value))); + fmt::format("Viewport height: {}", std::bit_cast<float>(value))); case XFMEM_SETVIEWPORT + 2: return std::make_pair(RegName(XFMEM_SETVIEWPORT + 2), - fmt::format("Viewport z range: {}", Common::BitCast<float>(value))); + fmt::format("Viewport z range: {}", std::bit_cast<float>(value))); case XFMEM_SETVIEWPORT + 3: return std::make_pair(RegName(XFMEM_SETVIEWPORT + 3), - fmt::format("Viewport x origin: {}", Common::BitCast<float>(value))); + fmt::format("Viewport x origin: {}", std::bit_cast<float>(value))); case XFMEM_SETVIEWPORT + 4: return std::make_pair(RegName(XFMEM_SETVIEWPORT + 4), - fmt::format("Viewport y origin: {}", Common::BitCast<float>(value))); + fmt::format("Viewport y origin: {}", std::bit_cast<float>(value))); case XFMEM_SETVIEWPORT + 5: return std::make_pair(RegName(XFMEM_SETVIEWPORT + 5), - fmt::format("Viewport far z: {}", Common::BitCast<float>(value))); + fmt::format("Viewport far z: {}", std::bit_cast<float>(value))); break; case XFMEM_SETPROJECTION: return std::make_pair(RegName(XFMEM_SETPROJECTION + 0), - fmt::format("Projection[0]: {}", Common::BitCast<float>(value))); + fmt::format("Projection[0]: {}", std::bit_cast<float>(value))); case XFMEM_SETPROJECTION + 1: return std::make_pair(RegName(XFMEM_SETPROJECTION + 1), - fmt::format("Projection[1]: {}", Common::BitCast<float>(value))); + fmt::format("Projection[1]: {}", std::bit_cast<float>(value))); case XFMEM_SETPROJECTION + 2: return std::make_pair(RegName(XFMEM_SETPROJECTION + 2), - fmt::format("Projection[2]: {}", Common::BitCast<float>(value))); + fmt::format("Projection[2]: {}", std::bit_cast<float>(value))); case XFMEM_SETPROJECTION + 3: return std::make_pair(RegName(XFMEM_SETPROJECTION + 3), - fmt::format("Projection[3]: {}", Common::BitCast<float>(value))); + fmt::format("Projection[3]: {}", std::bit_cast<float>(value))); case XFMEM_SETPROJECTION + 4: return std::make_pair(RegName(XFMEM_SETPROJECTION + 4), - fmt::format("Projection[4]: {}", Common::BitCast<float>(value))); + fmt::format("Projection[4]: {}", std::bit_cast<float>(value))); case XFMEM_SETPROJECTION + 5: return std::make_pair(RegName(XFMEM_SETPROJECTION + 5), - fmt::format("Projection[5]: {}", Common::BitCast<float>(value))); + fmt::format("Projection[5]: {}", std::bit_cast<float>(value))); case XFMEM_SETPROJECTION + 6: return std::make_pair(RegName(XFMEM_SETPROJECTION + 6), fmt::to_string(static_cast<ProjectionType>(value))); @@ -546,7 +547,7 @@ std::string GetXFMemDescription(u32 address, u32 value) (address >= XFMEM_POSTMATRICES && address < XFMEM_POSTMATRICES_END)) { // The matrices all use floats - return fmt::format("{} = {}", GetXFMemName(address), Common::BitCast<float>(value)); + return fmt::format("{} = {}", GetXFMemName(address), std::bit_cast<float>(value)); } else if (address >= XFMEM_LIGHTS && address < XFMEM_LIGHTS_END) { @@ -560,7 +561,7 @@ std::string GetXFMemDescription(u32 address, u32 value) else { // Everything else is a float - return fmt::format("{} = {}", GetXFMemName(address), Common::BitCast<float>(value)); + return fmt::format("{} = {}", GetXFMemName(address), std::bit_cast<float>(value)); } } else |
