mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-06-06 18:31:03 +00:00
PowerUtils: implemented endian swap for enums
This commit is contained in:
parent
d8676283fd
commit
62e3188a81
@ -89,6 +89,11 @@ struct be
|
|||||||
const uint32_t swapped = std::byteswap(*reinterpret_cast<uint32_t*>(&value));
|
const uint32_t swapped = std::byteswap(*reinterpret_cast<uint32_t*>(&value));
|
||||||
return *reinterpret_cast<const T*>(&swapped);
|
return *reinterpret_cast<const T*>(&swapped);
|
||||||
}
|
}
|
||||||
|
else if constexpr (std::is_enum_v<T>)
|
||||||
|
{
|
||||||
|
const std::underlying_type_t<T> swapped = std::byteswap(*reinterpret_cast<std::underlying_type_t<T>*>(&value));
|
||||||
|
return *reinterpret_cast<const T*>(&swapped);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return std::byteswap(value);
|
return std::byteswap(value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user