which bit is set in a byte?

abalone:
thanks to everyone!

this is what I was looking for: number = log(fnMCP23017Read(INFTFA))/log(2);

school math is long time ago... :frowning:

looping through 8 bits might be almost as fast...

Checking 8 bits is going to be much faster than performing floating-point logarithm and division operations.