summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-08-02 17:53:18 -0400
committerLioncash <mathew1800@gmail.com>2019-08-02 18:25:09 -0400
commitdb3b31c2463a4dfa3caaa416a5d3c9ab8a59889b (patch)
treeba23d99a9b7c20d20ce50703c397a07d15408b66 /Source/Core/DiscIO
parentc70da390a76af650a44bdddd8f75083c54cebed6 (diff)
DiscIO/Volume: Make Partition's interface constexpr
PARTITION_NONE technically has a runtime static constructor otherwise. This allows compile-time instances of Partition to be created without the use of a static constructor.
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Volume.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h
index a26db94370..05325aced2 100644
--- a/Source/Core/DiscIO/Volume.h
+++ b/Source/Core/DiscIO/Volume.h
@@ -26,18 +26,18 @@ class VolumeWAD;
struct Partition final
{
- Partition() : offset(std::numeric_limits<u64>::max()) {}
- explicit Partition(u64 offset_) : offset(offset_) {}
- bool operator==(const Partition& other) const { return offset == other.offset; }
- bool operator!=(const Partition& other) const { return !(*this == other); }
- bool operator<(const Partition& other) const { return offset < other.offset; }
- bool operator>(const Partition& other) const { return other < *this; }
- bool operator<=(const Partition& other) const { return !(*this < other); }
- bool operator>=(const Partition& other) const { return !(*this > other); }
- u64 offset;
+ constexpr Partition() = default;
+ constexpr explicit Partition(u64 offset_) : offset(offset_) {}
+ constexpr bool operator==(const Partition& other) const { return offset == other.offset; }
+ constexpr bool operator!=(const Partition& other) const { return !(*this == other); }
+ constexpr bool operator<(const Partition& other) const { return offset < other.offset; }
+ constexpr bool operator>(const Partition& other) const { return other < *this; }
+ constexpr bool operator<=(const Partition& other) const { return !(*this < other); }
+ constexpr bool operator>=(const Partition& other) const { return !(*this > other); }
+ u64 offset{std::numeric_limits<u64>::max()};
};
-const Partition PARTITION_NONE(std::numeric_limits<u64>::max() - 1);
+constexpr Partition PARTITION_NONE(std::numeric_limits<u64>::max() - 1);
class Volume
{