summaryrefslogtreecommitdiff
path: root/src/common/bit_field.h
diff options
context:
space:
mode:
authorGravatar bunnei2018-04-05 21:44:22 -0400
committerGravatar bunnei2018-04-13 23:48:18 -0400
commit0315fe8c3dc8cb267284b061a20b85c09cd5d98b (patch)
treeb6e88efcdab7a6752838d974b3f9e66ae94c2874 /src/common/bit_field.h
parentMerge pull request #323 from Hexagon12/stub-hid (diff)
downloadyuzu-0315fe8c3dc8cb267284b061a20b85c09cd5d98b.tar.gz
yuzu-0315fe8c3dc8cb267284b061a20b85c09cd5d98b.tar.xz
yuzu-0315fe8c3dc8cb267284b061a20b85c09cd5d98b.zip
bit_field: Make all methods constexpr.
Diffstat (limited to '')
-rw-r--r--src/common/bit_field.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 0cc0a1be0..5638bdbba 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -115,7 +115,7 @@ private:
115 // assignment would copy the full storage value, rather than just the bits 115 // assignment would copy the full storage value, rather than just the bits
116 // relevant to this particular bit field. 116 // relevant to this particular bit field.
117 // We don't delete it because we want BitField to be trivially copyable. 117 // We don't delete it because we want BitField to be trivially copyable.
118 BitField& operator=(const BitField&) = default; 118 constexpr BitField& operator=(const BitField&) = default;
119 119
120 // StorageType is T for non-enum types and the underlying type of T if 120 // StorageType is T for non-enum types and the underlying type of T if
121 // T is an enumeration. Note that T is wrapped within an enable_if in the 121 // T is an enumeration. Note that T is wrapped within an enable_if in the
@@ -166,20 +166,20 @@ public:
166 // so that we can use this within unions 166 // so that we can use this within unions
167 constexpr BitField() = default; 167 constexpr BitField() = default;
168 168
169 FORCE_INLINE operator T() const { 169 constexpr FORCE_INLINE operator T() const {
170 return Value(); 170 return Value();
171 } 171 }
172 172
173 FORCE_INLINE void Assign(const T& value) { 173 constexpr FORCE_INLINE void Assign(const T& value) {
174 storage = (storage & ~mask) | FormatValue(value); 174 storage = (storage & ~mask) | FormatValue(value);
175 } 175 }
176 176
177 FORCE_INLINE T Value() const { 177 constexpr T Value() const {
178 return ExtractValue(storage); 178 return ExtractValue(storage);
179 } 179 }
180 180
181 // TODO: we may want to change this to explicit operator bool() if it's bug-free in VS2015 181 // TODO: we may want to change this to explicit operator bool() if it's bug-free in VS2015
182 FORCE_INLINE bool ToBool() const { 182 constexpr FORCE_INLINE bool ToBool() const {
183 return Value() != 0; 183 return Value() != 0;
184 } 184 }
185 185