Two best ways I know to do this in pure C:
First linear-search the byte/word array to find the first byte/word that's nonzero, then do an unrolled binary-search of the byte/word you find.
if (b>=0x10)
if (b>=0x40)
if (b>=0x80) return 0;
else return 1;
else
if (b>=0x20) return 2;
else return 3;
else
if (b>=0x4)
if (b>=0x8) return 4;
else return 5;
else
if (b>=0x2) return 6;
else return 7;
3 (BTW that's log2(8)) conditional jumps to get the answer. On modern x86 machines the last one will be optimized to a conditional mov.
Alternatively, use a lookup table to map the byte to the index of the first bit that's set.
A related topic you might want to look up is integer log2 functions. If I recall, ffmpeg has a nice implementation.
Edit: You can actually make the above binary search into a branchless binary search, but I'm not sure if it would be more efficient in this case...