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.
This commit is contained in:
Lioncash 2020-10-20 08:42:30 -04:00
parent f653bd7559
commit 7bc2bbc508

View File

@ -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 <typename T, bool swapped = false>
DOLPHIN_FORCE_INLINE void Write(T data)
{
if (swapped)
if constexpr (swapped)
data = Common::FromBigEndian(data);
std::memcpy(buffer, &data, sizeof(T));