Skip to content

Commit

Permalink
Update tlsf.c
Browse files Browse the repository at this point in the history
Unsigned fix from Chris McEvoy @ Velan Studios.
  • Loading branch information
Matt Conte committed Mar 29, 2020
1 parent a1f743f commit deff9ab
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tlsf.c
Expand Up @@ -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);
}
}
}
Expand All @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit deff9ab

Please sign in to comment.