From 8f3eeb87b98b5d2a437af2c9307dcfffa35765dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 6 Sep 2020 21:22:30 +0200 Subject: [PATCH] Move SizedEnum to sead It is useful in sead and other libraries as well. --- lib/sead | 2 +- src/KingSystem/ActorSystem/actBaseProcMgr.h | 3 ++- src/KingSystem/Utils/Byaml.h | 3 ++- src/KingSystem/Utils/Types.h | 22 --------------------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/lib/sead b/lib/sead index 46ef57b9..71855f04 160000 --- a/lib/sead +++ b/lib/sead @@ -1 +1 @@ -Subproject commit 46ef57b925a24bfb54cbd679a5ecfb413be2d3dc +Subproject commit 71855f048ff11c9520e13377efff2ac1f47166ef diff --git a/src/KingSystem/ActorSystem/actBaseProcMgr.h b/src/KingSystem/ActorSystem/actBaseProcMgr.h index 9f278515..a1ce35d8 100644 --- a/src/KingSystem/ActorSystem/actBaseProcMgr.h +++ b/src/KingSystem/ActorSystem/actBaseProcMgr.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include "KingSystem/ActorSystem/actBaseProc.h" @@ -176,7 +177,7 @@ private: static u32 sConstant4; Status mStatus = Status::Idle; - util::SizedEnum mJobType = JobType::Invalid; + sead::SizedEnum mJobType = JobType::Invalid; u8 mCurrentlyProcessingPrio = 8; u8 mCounter = 0; sead::CriticalSection mProcMapCS; diff --git a/src/KingSystem/Utils/Byaml.h b/src/KingSystem/Utils/Byaml.h index c15f0802..56dddd61 100644 --- a/src/KingSystem/Utils/Byaml.h +++ b/src/KingSystem/Utils/Byaml.h @@ -4,6 +4,7 @@ #include #include +#include #include "KingSystem/Utils/Types.h" namespace al { @@ -162,7 +163,7 @@ struct ByamlData { void set(u8, u32, bool byteswap); u32 value = 0; - ksys::util::SizedEnum type = ByamlType::Invalid; + sead::SizedEnum type = ByamlType::Invalid; }; bool tryGetByamlS32(s32* value, const ByamlIter& iter, const char* key); diff --git a/src/KingSystem/Utils/Types.h b/src/KingSystem/Utils/Types.h index e29701ae..cc2b6e4b 100644 --- a/src/KingSystem/Utils/Types.h +++ b/src/KingSystem/Utils/Types.h @@ -7,25 +7,3 @@ #else #define KSYS_CHECK_SIZE_NX150(CLASS, SIZE) static_assert(sizeof(CLASS) == SIZE) #endif - -namespace ksys::util { - -/// For storing an enum with a particular storage size when specifying the underlying type of the -/// enum is not an option. -template -struct SizedEnum { - static_assert(std::is_enum()); - static_assert(!std::is_enum()); - - constexpr SizedEnum() = default; - constexpr SizedEnum(Enum value) { *this = value; } - constexpr operator Enum() const { return static_cast(mValue); } - constexpr SizedEnum& operator=(Enum value) { - mValue = static_cast(value); - return *this; - } - - Storage mValue; -}; - -} // namespace ksys::util