bitmap: fix bitmal_clear() clearing bits in the wrong direction

This commit is contained in:
2026-02-08 12:47:58 +00:00
parent 9e223ca5d0
commit 687ba31d55

View File

@@ -25,7 +25,7 @@ void bitmap_set(unsigned long *map, unsigned long bit)
void bitmap_clear(unsigned long *map, unsigned long bit)
{
unsigned long index = bit / BITS_PER_WORD;
unsigned long offset = bit & (BITS_PER_WORD - 1);
unsigned long offset = (BITS_PER_WORD - bit - 1) & (BITS_PER_WORD - 1);
unsigned long mask = 1ul << offset;
map[index] &= ~mask;