diff --git a/src/core/common_code/common_code.h b/src/core/common_code/common_code.h index 6c6d034..d089f2e 100644 --- a/src/core/common_code/common_code.h +++ b/src/core/common_code/common_code.h @@ -102,7 +102,7 @@ public: // ------------------------------------------------------------------------------------- // /// Get the original u64 code. - [[nodiscard]] uint64_t unwrap() const; + [[nodiscard]] constexpr uint64_t unwrap() const; /// Convert CommonCode to RawCode. [[nodiscard]] RawCode to_raw_code() const; diff --git a/src/core/common_code/internal/common_code.inl b/src/core/common_code/internal/common_code.inl index 3b284a9..575bdb2 100644 --- a/src/core/common_code/internal/common_code.inl +++ b/src/core/common_code/internal/common_code.inl @@ -41,7 +41,7 @@ inline std::ostream& operator<<(std::ostream &out, const CommonCode self) { // ----------------------------------------------------------------------------------------- // -inline uint64_t CommonCode::unwrap() const { +constexpr uint64_t CommonCode::unwrap() const { return code_; } diff --git a/src/core/group/group.h b/src/core/group/group.h index a7f8b27..b60661c 100644 --- a/src/core/group/group.h +++ b/src/core/group/group.h @@ -125,7 +125,7 @@ public: static constexpr GroupUnion from_raw_code(codec::RawCode raw_code); /// Create GroupUnion from ShortCode. - static constexpr GroupUnion from_short_code(codec::ShortCode short_code); + static GroupUnion from_short_code(codec::ShortCode short_code); /// Create GroupUnion from CommonCode. static constexpr GroupUnion from_common_code(codec::CommonCode common_code); diff --git a/src/core/group/internal/group_union.inl b/src/core/group/internal/group_union.inl index 68d7f3f..72064eb 100644 --- a/src/core/group/internal/group_union.inl +++ b/src/core/group/internal/group_union.inl @@ -43,7 +43,7 @@ constexpr std::optional GroupUnion::create(const uint_fast8_t type_i #ifndef KLSK_NDEBUG inline std::ostream& operator<<(std::ostream &out, GroupUnion self) { - out << self.type_id_; + out << static_cast(self.type_id_); return out; } #endif @@ -58,7 +58,7 @@ constexpr GroupUnion GroupUnion::from_raw_code(const codec::RawCode raw_code) { return unsafe_create(type_id(raw_code)); } -constexpr GroupUnion GroupUnion::from_short_code(const codec::ShortCode short_code) { +inline GroupUnion GroupUnion::from_short_code(const codec::ShortCode short_code) { return from_common_code(short_code.to_common_code()); } diff --git a/src/core/raw_code/internal/raw_code.inl b/src/core/raw_code/internal/raw_code.inl index 43e70d3..7b13e65 100644 --- a/src/core/raw_code/internal/raw_code.inl +++ b/src/core/raw_code/internal/raw_code.inl @@ -27,7 +27,7 @@ inline RawCode::operator uint64_t() const { return code_; } -inline uint64_t RawCode::unwrap() const { +constexpr uint64_t RawCode::unwrap() const { return code_; } diff --git a/src/core/raw_code/raw_code.h b/src/core/raw_code/raw_code.h index ff5f8e9..7f5cd7b 100644 --- a/src/core/raw_code/raw_code.h +++ b/src/core/raw_code/raw_code.h @@ -101,7 +101,7 @@ public: // ------------------------------------------------------------------------------------- // /// Get the original u64 code. - [[nodiscard]] uint64_t unwrap() const; + [[nodiscard]] constexpr uint64_t unwrap() const; /// Convert RawCode to CommonCode. [[nodiscard]] CommonCode to_common_code() const;