I am trying to write a bitmapped memory manager just for the exercise of doing it, and I am having trouble with a little function I am trying to write. The idea of it is that it does a simple linear scan through a bitmap to try to find a consecutive run of 1s in the bitmap long enough to satisfy our demands and returns the starting position of that run. Never mind that the function does no such thing at the moment. I am just trying to get the first part right: scan until we find the first 1. But the problem is that my equality test seems not to be working. Could someone please explain why?
I have arbitrarily set the first eight bits to be zero, so the initial state of the bitmap is 0xffffffffffffff00. When I run the function I expect the bit to be rotated to the left eight times and to print out 8. Instead, it prints out 1, which was the initial value.
int _Find_Contiguous_Blocks(int blocks)
unsigned long bit = 0x1;
while(bit & bitmap == 0x0UL)
bit = uint_64_rotate_left_1(bit); // Never seems to get executed....
What am I doing wrong?