I'm trying to think of an efficient algorithm that can return a bitmask giving the position of the first bit that is a '1', counted left from the input.
For example: 00010101 should give 00010000 and 11111111 should give 10000000
The obvious way I guess would be to do make a loop that checks first bit and shifts bitwise until end of string, but I would like to avoid loops if at all possible.
Anyone who thinks they have a good solution to this, feel free to post!