Common/BitField: Fix off-by-one error for signed types

Fixes Darkstalkers 3 character select screen.
This commit is contained in:
Connor McLaughlin 2020-04-27 00:13:23 +10:00
parent dc1e1b5adf
commit 341b163ca1
1 changed files with 2 additions and 2 deletions

View File

@ -119,8 +119,8 @@ struct BitField
}
else if constexpr (std::is_signed_v<DataType>)
{
constexpr int shift = 8 * sizeof(DataType) - BitCount;
return (static_cast<DataType>((data & GetMask()) >> BitIndex) << shift) >> shift;
constexpr int shift = 8 * sizeof(DataType) - BitCount + 1;
return (static_cast<DataType>(data >> BitIndex) << shift) >> shift;
}
else
{