Bitmap: short circuit on 0-byte clears

This commit is contained in:
apio 2022-12-07 14:32:41 +01:00 committed by Gitea
parent 4fdd1d57f5
commit d3458f2f0f

View File

@ -62,6 +62,8 @@ void Bitmap::clear_region(usize start, usize bits, bool value)
expect(initialized(), "Bitmap was never initialized"); expect(initialized(), "Bitmap was never initialized");
expect((start + bits) <= size(), "Bitmap clear out of range"); expect((start + bits) <= size(), "Bitmap clear out of range");
if (!bits) return;
// Set individual bits while not on a byte boundary. // Set individual bits while not on a byte boundary.
while ((start % 8) && bits--) while ((start % 8) && bits--)
{ {