From 687ba31d55c790d106fc434dd82c2fab3e4ac099 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 8 Feb 2026 12:47:58 +0000 Subject: [PATCH] bitmap: fix bitmal_clear() clearing bits in the wrong direction --- ds/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ds/bitmap.c b/ds/bitmap.c index 064d10c..514be59 100644 --- a/ds/bitmap.c +++ b/ds/bitmap.c @@ -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;