I have a bitmap
uint64_t bitmap[10000]
to keep track of the resources allocated in the system. Now the question is how do efficiently I
I'm not sure how you'd get much faster than this, but I'm open to being proven wrong:
uint64_t bitmap[10000];
unsigned int i;
for (i = 0; i < (sizeof(bitmap) / sizeof(*bitmap)) && 0xFFFFFFFFFFFFFFFF == bitmap[i]; ++i);
const int bitInWord = ffsll(bitmap[i]);
const unsigned int firstZeroBit = bitInWord ? i * sizeof(*bitmap) * CHAR_BIT + bitInWord : 0;