mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-10-30 07:11:38 +00:00
PowerUtils: implemented endian swap for enums
This commit is contained in:
parent
d8676283fd
commit
62e3188a81
1 changed files with 5 additions and 0 deletions
|
|
@ -89,6 +89,11 @@ struct be
|
|||
const uint32_t swapped = std::byteswap(*reinterpret_cast<uint32_t*>(&value));
|
||||
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
|
||||
{
|
||||
return std::byteswap(value);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue