I am looking for an efficient way to determine the position of the least significant bit that is set in an integer, e.g. for 0x0FF0 it would be 4.
A trivial impleme
You could check if any of the lower order bits are set. If so then look at the lower order of the remaining bits. e.g.,:
32bit int - check if any of the first 16 are set. If so, check if any of the first 8 are set. if so, ....
if not, check if any of the upper 16 are set..
Essentially it's binary search.