I have a uint64_t
and I would like to find the index of the first set bit, reset it to zero and find the next set bit.
How do I know when to terminate? BSF on all zeros is undefined...
const uint64_t input = source;if(0 != input){ int32_t setIndex = GCC_BSF_INTRINSIC(input); while(setIndex != UNDEFINED???){ //Do my logic //Reset input[setIndex] = 0; setIndex = BSF_Variant(input); }}
Could somebody please help?