I have the exercise with following code
int FindFirstSet(unsigned BitMap, unsigned start)
{
unsigned Mask = (1 << start);
while (Mask)
{
if (BitMap & Mask) return start;
++start;
Mask <<= 1;
}
return -1;
}
The question is :
“The C++ programming language does not specify how many bits there are in an unsigned
integer. Explain why the code above will work regardless of the number of bits in an
unsigned integer.”
Follow this question, could I think that: any type of “Bitmap parameter” was, the “start parameter” also have Bitmap’s type?
All parameters and variables are unsigned int.