mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-03-06 14:27:44 +00:00
Common/BitField: Fix off-by-one error for signed types
Fixes Darkstalkers 3 character select screen.
This commit is contained in:
parent
dc1e1b5adf
commit
341b163ca1
|
@ -119,8 +119,8 @@ struct BitField
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_signed_v<DataType>)
|
else if constexpr (std::is_signed_v<DataType>)
|
||||||
{
|
{
|
||||||
constexpr int shift = 8 * sizeof(DataType) - BitCount;
|
constexpr int shift = 8 * sizeof(DataType) - BitCount + 1;
|
||||||
return (static_cast<DataType>((data & GetMask()) >> BitIndex) << shift) >> shift;
|
return (static_cast<DataType>(data >> BitIndex) << shift) >> shift;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue