As said. e.g. for the 8-bit(just for example, no byte order considered) integer 00100100, is there an instruction gives 5?
Thanks in advance,
As said. e.g. for the 8-bit(just for example, no byte order considered) integer 00100100, is there an instruction gives 5?
Thanks in advance,
Yep, BSR. However, do note that the bithack page claims that at least on one CPU a sequence (unrolled loop) of bit shift operations is faster than a single BSR.
Technically, no. There's BSR to find the most significant bit that's set, and BSF to find the least significant bit that's set -- but the smallest item either will work on is a 16-bit word.