Skip to content

Commit

Permalink
Merge pull request #2738 from lioncash/bitfield
Browse files Browse the repository at this point in the history
Common: Fix BitField mask generation.
  • Loading branch information
shuffle2 committed Oct 4, 2015
2 parents 81414b4 + 5c26428 commit 0fdaacc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Common/BitField.h
Expand Up @@ -146,7 +146,7 @@ struct BitField
if (std::numeric_limits<T>::is_signed)
{
std::size_t shift = 8 * sizeof(T) - bits;
return (T)(((storage & GetMask()) << (shift - position)) >> shift);
return (T)((storage << (shift - position)) >> shift);
}
else
{
Expand All @@ -173,7 +173,7 @@ struct BitField

__forceinline StorageType GetMask() const
{
return ((~(StorageTypeU)0) >> (8 * sizeof(T) - bits)) << position;
return (((StorageTypeU)~0) >> (8 * sizeof(T) - bits)) << position;
}

StorageType storage;
Expand Down

0 comments on commit 0fdaacc

Please sign in to comment.