mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
HID: core: don't use negative operands when shift
The recent C standard in 6.5.7 paragraph 4 defines that operands for bitwise shift operators should be non-negative, otherwise it's an undefined behaviour. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
This commit is contained in:
parent
91b9ae48aa
commit
08585e43d2
1 changed files with 1 additions and 1 deletions
|
|
@ -1046,7 +1046,7 @@ static s32 snto32(__u32 value, unsigned n)
|
|||
case 16: return ((__s16)value);
|
||||
case 32: return ((__s32)value);
|
||||
}
|
||||
return value & (1 << (n - 1)) ? value | (-1 << n) : value;
|
||||
return value & (1 << (n - 1)) ? value | (~0U << n) : value;
|
||||
}
|
||||
|
||||
s32 hid_snto32(__u32 value, unsigned n)
|
||||
|
|
|
|||
Loading…
Reference in a new issue