mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
Minor fix in UBSan.
This commit is contained in:
committed by
Petro Karashchenko
parent
06cf41901f
commit
c22c07ba29
+3
-3
@@ -157,11 +157,11 @@ static int64_t get_signed_val(FAR struct type_descriptor *type,
|
|||||||
{
|
{
|
||||||
if (is_inline_int(type))
|
if (is_inline_int(type))
|
||||||
{
|
{
|
||||||
unsigned extra_bits = sizeof(int64_t) * 8 - type_bit_width(type);
|
unsigned bits = type_bit_width(type);
|
||||||
uint64_t mask = (1llu << extra_bits) - 1;
|
uint64_t mask = (1llu << bits) - 1;
|
||||||
uint64_t ret = (uint64_t)val & mask;
|
uint64_t ret = (uint64_t)val & mask;
|
||||||
|
|
||||||
return (int64_t)(((ret & (1llu << (extra_bits - 1))) != 0) ?
|
return (int64_t)(((ret & (1llu << (bits - 1))) != 0) ?
|
||||||
ret | ~mask : ret);
|
ret | ~mask : ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user