فهرست منبع

BitField: Add an explicit Assign method.

This is useful when doing crazy stuff like inheriting from BitField.
Tony Wasserka 11 سال پیش
والد
کامیت
95be6a09b2
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      src/common/bit_field.h

+ 5 - 1
src/common/bit_field.h

@@ -142,7 +142,7 @@ public:
 
     __forceinline BitField& operator=(T val)
     {
-        storage = (storage & ~GetMask()) | (((StorageType)val << position) & GetMask());
+        Assign(val);
         return *this;
     }
 
@@ -151,6 +151,10 @@ public:
         return Value();
     }
 
+    __forceinline void Assign(const T& value) {
+        storage = (storage & ~GetMask()) | (((StorageType)value << position) & GetMask());
+    }
+
     __forceinline T Value() const
     {
         if (std::numeric_limits<T>::is_signed)