Skip to content

Commit d808185

Browse files
committed
Emphasize that ALIGN_BITS is a constant
1 parent d2361ae commit d808185

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shared-module/displayio/Bitmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030

3131
#include "py/runtime.h"
3232

33-
enum { align_bits = 8 * sizeof(uint32_t) };
33+
enum { ALIGN_BITS = 8 * sizeof(uint32_t) };
3434

3535
static int stride(uint32_t width, uint32_t bits_per_value) {
3636
uint32_t row_width = width * bits_per_value;
3737
// align to uint32_t
38-
return (row_width + align_bits - 1) / align_bits;
38+
return (row_width + ALIGN_BITS - 1) / ALIGN_BITS;
3939
}
4040

4141
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,
6666
self->x_shift = 0; // Used to divide the index by the number of pixels per word. Its used in a
6767
// shift which effectively divides by 2 ** x_shift.
6868
uint32_t power_of_two = 1;
69-
while (power_of_two < align_bits / bits_per_value) {
69+
while (power_of_two < ALIGN_BITS / bits_per_value) {
7070
self->x_shift++;
7171
power_of_two <<= 1;
7272
}

0 commit comments

Comments
 (0)