CCollisionEdge: Make constructors constexpr

Makes the default and non-stream iterator constexpr, which allows for
elimination of a runtime initializer.
This commit is contained in:
Lioncash 2020-04-05 06:44:47 -04:00
parent af6e3b21f8
commit a952ff1110
2 changed files with 6 additions and 6 deletions

View File

@ -8,14 +8,14 @@ class CCollisionEdge {
u16 x2_index2 = -1;
public:
CCollisionEdge() = default;
constexpr CCollisionEdge() noexcept = default;
explicit CCollisionEdge(CInputStream&);
CCollisionEdge(u16 v0, u16 v1) : x0_index1(v0), x2_index2(v1) {}
constexpr CCollisionEdge(u16 v0, u16 v1) noexcept : x0_index1(v0), x2_index2(v1) {}
u16 GetVertIndex1() const { return x0_index1; }
u16 GetVertIndex2() const { return x2_index2; }
[[nodiscard]] constexpr u16 GetVertIndex1() const noexcept { return x0_index1; }
[[nodiscard]] constexpr u16 GetVertIndex2() const noexcept { return x2_index2; }
void swapBig() {
constexpr void swapBig() noexcept {
x0_index1 = hecl::SBig(x0_index1);
x2_index2 = hecl::SBig(x2_index2);
}

View File

@ -14,7 +14,7 @@ constexpr std::array<u8, 12> DefaultSurfaceMaterials{
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
};
const std::array<CCollisionEdge, 18> DefaultEdges{{
constexpr std::array<CCollisionEdge, 18> DefaultEdges{{
{4, 1},
{1, 5},
{5, 4},