From 7bc2bbc508d6c2ef926519854d6d7e2d0a880835 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Oct 2020 08:42:30 -0400 Subject: [PATCH] DataReader: Make use of if constexpr where applicable We can make use of if constexpr for cases where booleans will always statically be known at compile-time. --- Source/Core/VideoCommon/DataReader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoCommon/DataReader.h b/Source/Core/VideoCommon/DataReader.h index 7ab572734a..55bd678cb1 100644 --- a/Source/Core/VideoCommon/DataReader.h +++ b/Source/Core/VideoCommon/DataReader.h @@ -30,7 +30,7 @@ public: T data; std::memcpy(&data, &buffer[offset], sizeof(T)); - if (swapped) + if constexpr (swapped) data = Common::FromBigEndian(data); return data; @@ -47,7 +47,7 @@ public: template DOLPHIN_FORCE_INLINE void Write(T data) { - if (swapped) + if constexpr (swapped) data = Common::FromBigEndian(data); std::memcpy(buffer, &data, sizeof(T));