From 4dbd6f6bbc4c30472ad728755512e319386b2ad3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 18 May 2018 14:25:40 -0400 Subject: [PATCH] BPMemory: Use Common::BitCast where applicable Gets rid of memcpy boilerplating for reinterpreting bits properly. --- Source/Core/VideoCommon/BPMemory.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/Core/VideoCommon/BPMemory.cpp b/Source/Core/VideoCommon/BPMemory.cpp index fe6e62ed6e..cb510e9e6a 100644 --- a/Source/Core/VideoCommon/BPMemory.cpp +++ b/Source/Core/VideoCommon/BPMemory.cpp @@ -4,7 +4,7 @@ #include "VideoCommon/BPMemory.h" -#include +#include "Common/BitUtils.h" // BP state // STATE_TO_SAVE @@ -56,9 +56,7 @@ float FogParams::GetA() const const u32 integral = (static_cast(a.sign) << 31) | (static_cast(a.exp) << 23) | (static_cast(a.mant) << 12); - float real; - std::memcpy(&real, &integral, sizeof(u32)); - return real; + return Common::BitCast(integral); } float FogParams::GetC() const @@ -73,7 +71,5 @@ float FogParams::GetC() const const u32 integral = (c_proj_fsel.c_sign.Value() << 31) | (c_proj_fsel.c_exp.Value() << 23) | (c_proj_fsel.c_mant.Value() << 12); - float real; - std::memcpy(&real, &integral, sizeof(u32)); - return real; + return Common::BitCast(integral); }