From deff9ab509341f264addbd3c8ada533678591905 Mon Sep 17 00:00:00 2001 From: Matt Conte Date: Sun, 29 Mar 2020 09:55:11 -0700 Subject: [PATCH] Update tlsf.c Unsigned fix from Chris McEvoy @ Velan Studios. --- tlsf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tlsf.c b/tlsf.c index f4fc786..af57573 100644 --- a/tlsf.c +++ b/tlsf.c @@ -590,12 +590,12 @@ static void remove_free_block(control_t* control, block_header_t* block, int fl, /* If the new head is null, clear the bitmap. */ if (next == &control->block_null) { - control->sl_bitmap[fl] &= ~(1 << sl); + control->sl_bitmap[fl] &= ~(1U << sl); /* If the second bitmap is now empty, clear the fl bitmap. */ if (!control->sl_bitmap[fl]) { - control->fl_bitmap &= ~(1 << fl); + control->fl_bitmap &= ~(1U << fl); } } } @@ -618,8 +618,8 @@ static void insert_free_block(control_t* control, block_header_t* block, int fl, ** and second-level bitmaps appropriately. */ control->blocks[fl][sl] = block; - control->fl_bitmap |= (1 << fl); - control->sl_bitmap[fl] |= (1 << sl); + control->fl_bitmap |= (1U << fl); + control->sl_bitmap[fl] |= (1U << sl); } /* Remove a given block from the free list. */ @@ -853,9 +853,9 @@ int tlsf_check(tlsf_t tlsf) { for (j = 0; j < SL_INDEX_COUNT; ++j) { - const int fl_map = control->fl_bitmap & (1 << i); + const int fl_map = control->fl_bitmap & (1U << i); const int sl_list = control->sl_bitmap[i]; - const int sl_map = sl_list & (1 << j); + const int sl_map = sl_list & (1U << j); const block_header_t* block = control->blocks[i][j]; /* Check that first- and second-level lists agree. */