MichaĆ Janiszewski janisozaur@gmail.com writes:
It looks like your way indeed solves the problem as I am no longer able to observe the issue I saw earlier and I simply have not fully understood the way you rewrote the code.
The way it works is that start and count have already been checked against the bitmap size, so we can assume that the mask's high bits won't be set if they wouldn't fit, there's no need to check the size again.