I want to check if any of the 1024 bits (128 bytes) are set. If all are clear, then I want to do something. Is it possible to do this quickly, i.e one instruction or do I have to loop through my bitmap?
As i have understood the questions, you want to check if any of the bit is set out of 1024 bits you have.
Assuming you are on 64 bit machine.
store the bits as array of unit64_t
type which is 8 bytes
.
So you have array of this kind.
uint64_t bits[16] = {0}; // 1024 bits
and to check your bit condition
for(int i = 0, j=0; i < 16; i++){
if(bits[i]) {
return FAIL_CONDITION;
}
}
return SUCCESS_CONDITION;