ref: 6478a56726884d731039d1a38ff376ee955e1783
parent: 79b2fed04cf818c81186a8df50a566ec2415cc40
author: Fabian Greffrath <[email protected]>
date: Mon Jan 28 04:25:31 EST 2019
net: explicitly declare a bit-shifted 1 literal as unsigned This fixes a future "Shifting signed 32-bit value by 31 bits is undefined behaviour" cppcheck error.
--- a/src/net_packet.c
+++ b/src/net_packet.c
@@ -158,10 +158,10 @@
{
if (NET_ReadInt32(packet, (unsigned int *) data))
{
- if (*data & (1 << 31))
+ if (*data & (1U << 31))
{
- *data &= ~(1 << 31);
- *data -= (1 << 31);
+ *data &= ~(1U << 31);
+ *data -= (1U << 31);
}
return true;
}