From d8081857444496b8849a8a910ef0fda771f1cfce Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 1 Jan 2023 16:40:06 -0600 Subject: [PATCH] Emphasize that ALIGN_BITS is a constant --- shared-module/displayio/Bitmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index ab1b85ea16..7a1b3e6b17 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -30,12 +30,12 @@ #include "py/runtime.h" -enum { align_bits = 8 * sizeof(uint32_t) }; +enum { ALIGN_BITS = 8 * sizeof(uint32_t) }; static int stride(uint32_t width, uint32_t bits_per_value) { uint32_t row_width = width * bits_per_value; // align to uint32_t - return (row_width + align_bits - 1) / align_bits; + return (row_width + ALIGN_BITS - 1) / ALIGN_BITS; } void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t width, @@ -66,7 +66,7 @@ void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self, self->x_shift = 0; // Used to divide the index by the number of pixels per word. Its used in a // shift which effectively divides by 2 ** x_shift. uint32_t power_of_two = 1; - while (power_of_two < align_bits / bits_per_value) { + while (power_of_two < ALIGN_BITS / bits_per_value) { self->x_shift++; power_of_two <<= 1; }