which bit is set in a byte?

The inverse function of f(x) = 2^x is log(x)/log(2)

See this:

#include <math.h>

void setup() {
byte t[] = {1, 2, 4, 8, 16, 32, 64, 128};
Serial.begin(9600);
for (byte i = 0 ; i < 8 ; i++)
  Serial.println(int(log(t[i])/0.6931));
}

void loop() {
}

Jacques