2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #914 from yuriks/bitfield-mask

Common: Fix mask generation in BitField
This commit is contained in:
Yuri Kunde Schlesner 2015-07-11 19:01:57 -07:00
commit b0d72e3de1

View file

@ -161,7 +161,7 @@ public:
if (std::numeric_limits<T>::is_signed) if (std::numeric_limits<T>::is_signed)
{ {
std::size_t shift = 8 * sizeof(T)-bits; std::size_t shift = 8 * sizeof(T)-bits;
return (T)(((storage & GetMask()) << (shift - position)) >> shift); return (T)((storage << (shift - position)) >> shift);
} }
else else
{ {
@ -189,7 +189,7 @@ private:
__forceinline StorageType GetMask() const __forceinline StorageType GetMask() const
{ {
return ((~(StorageTypeU)0) >> (8 * sizeof(T)-bits)) << position; return (((StorageTypeU)~0) >> (8 * sizeof(T)-bits)) << position;
} }
StorageType storage; StorageType storage;