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/RetroTypes.hpp"
#include <zeus/CVector3f.hpp>
namespace urde {
class CSegId {
u8 x0_segId = 0xff;
public:
CSegId() = default;
CSegId(u8 id) : x0_segId(id) {}
CSegId(CInputStream& in) : x0_segId(in.readUint32Big()) {}
CSegId& operator++() {
constexpr CSegId() noexcept = default;
constexpr CSegId(u8 id) noexcept : x0_segId(id) {}
explicit CSegId(CInputStream& in) : x0_segId(in.readUint32Big()) {}
constexpr CSegId& operator++() noexcept {
++x0_segId;
return *this;
}
CSegId& operator--() {
constexpr CSegId& operator--() noexcept {
--x0_segId;
return *this;
}
operator u8() const { return x0_segId; }
constexpr operator u8() const noexcept { return x0_segId; }
};
} // namespace urde