Fix copy/paste error with template param

This commit is contained in:
Stephen F. Booth
2024-12-09 12:02:06 -06:00
committed by Urs Fleisch
parent d30504ceb4
commit 1179c04ae5

View File

@ -186,11 +186,11 @@ TFloat toFloat(const ByteVector &v, size_t offset)
::memcpy(&tmp, v.data() + offset, sizeof(TInt));
if(ENDIAN != Utils::systemByteOrder()) {
if constexpr (sizeof(T) == 2)
if constexpr (sizeof(TInt) == 2)
tmp.i = Utils::byteSwap(static_cast<uint16_t>(tmp.i));
else if constexpr (sizeof(T) == 4)
else if constexpr (sizeof(TInt) == 4)
tmp.i = Utils::byteSwap(static_cast<uint32_t>(tmp.i));
else if constexpr (sizeof(T) == 8)
else if constexpr (sizeof(TInt) == 8)
tmp.i = Utils::byteSwap(static_cast<uint64_t>(tmp.i));
else
static_assert(false, "Byte swap requested for type with invalid size");
@ -209,11 +209,11 @@ ByteVector fromFloat(TFloat value)
tmp.f = value;
if(ENDIAN != Utils::systemByteOrder()) {
if constexpr (sizeof(T) == 2)
if constexpr (sizeof(TInt) == 2)
tmp.i = Utils::byteSwap(static_cast<uint16_t>(tmp.i));
else if constexpr (sizeof(T) == 4)
else if constexpr (sizeof(TInt) == 4)
tmp.i = Utils::byteSwap(static_cast<uint32_t>(tmp.i));
else if constexpr (sizeof(T) == 8)
else if constexpr (sizeof(TInt) == 8)
tmp.i = Utils::byteSwap(static_cast<uint64_t>(tmp.i));
else
static_assert(false, "Byte swap requested for type with invalid size");