diff --git a/src/common/bit_field.h b/src/common/bit_field.h index 6595b5ba4..f64ebdaf6 100644 --- a/src/common/bit_field.h +++ b/src/common/bit_field.h @@ -161,7 +161,7 @@ public: if (std::numeric_limits::is_signed) { std::size_t shift = 8 * sizeof(T)-bits; - return (T)(((storage & GetMask()) << (shift - position)) >> shift); + return (T)((storage << (shift - position)) >> shift); } else { @@ -189,7 +189,7 @@ private: __forceinline StorageType GetMask() const { - return ((~(StorageTypeU)0) >> (8 * sizeof(T)-bits)) << position; + return (((StorageTypeU)~0) >> (8 * sizeof(T)-bits)) << position; } StorageType storage;