From 3248041aeffe6c29a732ba450827dfb91e842411 Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 7 Dec 2022 14:32:41 +0100 Subject: [PATCH] Bitmap: short circuit on 0-byte clears --- luna/src/Bitmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/luna/src/Bitmap.cpp b/luna/src/Bitmap.cpp index 1928208e..a29fc947 100644 --- a/luna/src/Bitmap.cpp +++ b/luna/src/Bitmap.cpp @@ -62,6 +62,8 @@ void Bitmap::clear_region(usize start, usize bits, bool value) expect(initialized(), "Bitmap was never initialized"); expect((start + bits) <= size(), "Bitmap clear out of range"); + if (!bits) return; + // Set individual bits while not on a byte boundary. while ((start % 8) && bits--) {