Avoid an undefined shift
(1 << 32), an operation on a signed 32-bit int, is undefined in C. The operation on the unsigned int (1u<<32) is defined as zero, which is the desired outcome (subtracting 1 yields the value with all bits set) This problem was detected by clang scan-build static analysis
This commit is contained in:
parent
dc363e5a87
commit
d2361ae4f9
|
@ -70,8 +70,8 @@ void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self,
|
|||
self->x_shift++;
|
||||
power_of_two <<= 1;
|
||||
}
|
||||
self->x_mask = (1 << self->x_shift) - 1; // Used as a modulus on the x value
|
||||
self->bitmask = (1 << bits_per_value) - 1;
|
||||
self->x_mask = (1u << self->x_shift) - 1u; // Used as a modulus on the x value
|
||||
self->bitmask = (1u << bits_per_value) - 1u;
|
||||
|
||||
self->dirty_area.x1 = 0;
|
||||
self->dirty_area.x2 = width;
|
||||
|
|
Loading…
Reference in New Issue