Also take the unsigned -> signed conversion into account.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41846 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2925a66e80
commit
6d551ee44f
@ -118,9 +118,14 @@ HIDReportItem::SetData(uint32 data)
|
|||||||
uint32
|
uint32
|
||||||
HIDReportItem::ScaledData(uint8 scaleToBits, bool toBeSigned)
|
HIDReportItem::ScaledData(uint8 scaleToBits, bool toBeSigned)
|
||||||
{
|
{
|
||||||
uint32 source = fData;
|
uint32 source;
|
||||||
if (Signed() && !toBeSigned)
|
if (Signed() != toBeSigned) {
|
||||||
source = (uint32)((int32)fData - (int32)fMinimum);
|
if (toBeSigned)
|
||||||
|
source = (uint32)((int32)fData - (fMaximum + 1) / 2) & fMask;
|
||||||
|
else
|
||||||
|
source = (uint32)((int32)fData - (int32)fMinimum);
|
||||||
|
} else
|
||||||
|
source = fData;
|
||||||
|
|
||||||
if (fBitCount == scaleToBits)
|
if (fBitCount == scaleToBits)
|
||||||
return source;
|
return source;
|
||||||
|
Loading…
Reference in New Issue
Block a user