change validation maximum computation

This commit is contained in:
foamyguy 2023-02-18 10:35:39 -06:00
parent 5f3f87e371
commit 694537acb3
1 changed files with 3 additions and 1 deletions

View File

@ -156,7 +156,9 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
// load
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_bitmap_get_pixel(self, x, y));
} else {
mp_uint_t value = (mp_uint_t)mp_arg_validate_int_range(mp_obj_get_int(value_obj), 0,(1u << common_hal_displayio_bitmap_get_bits_per_value(self)) - 1, MP_QSTR_value);
mp_uint_t value = (mp_uint_t)mp_arg_validate_int_range(
mp_obj_get_int(value_obj), 0,
(UINT32_MAX >> (32 - common_hal_displayio_bitmap_get_bits_per_value(self))), MP_QSTR_value);
common_hal_displayio_bitmap_set_pixel(self, x, y, value);
}
return mp_const_none;