mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 13:10:21 +01:00
py: Fix undefined left shift operations.
By ensuring the value to be shifted is an unsigned of the appropriate type.
This fixes several runtime diagnostics such as:
../../py/binary.c:199:28: runtime error:
left shift of 32768 by 16 places
cannot be represented in type 'int'
Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
816246836e
commit
2c8ccd3ee8
@@ -196,7 +196,7 @@ static float mp_decode_half_float(uint16_t hf) {
|
||||
++e;
|
||||
}
|
||||
|
||||
fpu.i = ((hf & 0x8000) << 16) | (e << 23) | (m << 13);
|
||||
fpu.i = ((hf & 0x8000u) << 16) | (e << 23) | (m << 13);
|
||||
return fpu.f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user