Skip to content
Snippets Groups Projects
Commit 95be6a09 authored by Tony Wasserka's avatar Tony Wasserka
Browse files

BitField: Add an explicit Assign method.

This is useful when doing crazy stuff like inheriting from BitField.
parent 8cd0d9c0
No related branches found
No related tags found
Loading
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
__forceinline BitField& operator=(T val) __forceinline BitField& operator=(T val)
{ {
storage = (storage & ~GetMask()) | (((StorageType)val << position) & GetMask()); Assign(val);
return *this; return *this;
} }
...@@ -151,6 +151,10 @@ public: ...@@ -151,6 +151,10 @@ public:
return Value(); return Value();
} }
__forceinline void Assign(const T& value) {
storage = (storage & ~GetMask()) | (((StorageType)value << position) & GetMask());
}
__forceinline T Value() const __forceinline T Value() const
{ {
if (std::numeric_limits<T>::is_signed) if (std::numeric_limits<T>::is_signed)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment