Suppose a = a31 a30 . . . a1 a0 is a 32-bit binary word.
Consider the 32-bit binary word b = b31 b30 . . . b1 b0 computed by the following algorithm:
- Scan a from right to left and copy its bits to
buntil the first1is found (which is also copied tob) - After that, copy the Boolean negations of the bits in
a.
For example, a = 10100 . . . 00 is transformed to b = 01100 . . . 00. Explain what this algorithm computes if a and b are interpreted as binary numbers.