which bit is set in a byte?

Oh, then that's easy, just loop through the bits as suggested above.