CSegId: Make constexpr capable

Allows the class to be used within constexpr contexts, given it's such a
small class.
This commit is contained in:
Lioncash 2019-10-26 21:33:39 -04:00
parent 18382e5bb6
commit 30af6f0bfb
1 changed files with 6 additions and 8 deletions

View File

@ -3,26 +3,24 @@
#include "Runtime/IOStreams.hpp" #include "Runtime/IOStreams.hpp"
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
#include <zeus/CVector3f.hpp>
namespace urde { namespace urde {
class CSegId { class CSegId {
u8 x0_segId = 0xff; u8 x0_segId = 0xff;
public: public:
CSegId() = default; constexpr CSegId() noexcept = default;
CSegId(u8 id) : x0_segId(id) {} constexpr CSegId(u8 id) noexcept : x0_segId(id) {}
CSegId(CInputStream& in) : x0_segId(in.readUint32Big()) {} explicit CSegId(CInputStream& in) : x0_segId(in.readUint32Big()) {}
CSegId& operator++() { constexpr CSegId& operator++() noexcept {
++x0_segId; ++x0_segId;
return *this; return *this;
} }
CSegId& operator--() { constexpr CSegId& operator--() noexcept {
--x0_segId; --x0_segId;
return *this; return *this;
} }
operator u8() const { return x0_segId; } constexpr operator u8() const noexcept { return x0_segId; }
}; };
} // namespace urde } // namespace urde