mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Merge pull request #2738 from lioncash/bitfield
Common: Fix BitField mask generation.
This commit is contained in:
commit
0fdaacc7e0
@ -146,7 +146,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
|
||||||
{
|
{
|
||||||
@ -173,7 +173,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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user