From 62e3188a811aef25e84f63bd2957432e081a6dad Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Thu, 21 Nov 2024 01:47:03 +0000 Subject: [PATCH] PowerUtils: implemented endian swap for enums --- PowerUtils/xbox.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PowerUtils/xbox.h b/PowerUtils/xbox.h index 8c3cd46..2b21385 100644 --- a/PowerUtils/xbox.h +++ b/PowerUtils/xbox.h @@ -89,6 +89,11 @@ struct be const uint32_t swapped = std::byteswap(*reinterpret_cast(&value)); return *reinterpret_cast(&swapped); } + else if constexpr (std::is_enum_v) + { + const std::underlying_type_t swapped = std::byteswap(*reinterpret_cast*>(&value)); + return *reinterpret_cast(&swapped); + } else { return std::byteswap(value);