I am sure that this algorithm is as efficient and understandable as your related algorithm.
The strategy here is to understand that the only way to make a number larger without increasing its number is to transfer 1, but if you transfer several 1, then you must add them back.
Given the number 1001 1100
, , 0010 0111. : shifts = 2;
, , 0000 0100. . shifts += 3; bits = 3;
5 3 , . .
1. 0000 0101. 2 . bits -= 1
3 , 0. 0010 1000. , shifts - bits == 3 shifts -= 3
. , . 1010 0011. . bits -= 2; shifts -= 2; bits == 0; shifts == 0
... current_val, shifts_owed, bits_owed
0000 0110
0000 0110, 0, 0 # Start
0000 0011, 1, 0 # Shift right till odd
0000 0000, 3, 2 # Shift right till even
0000 0001, 3, 1 # Set LSB
0000 0100, 1, 1 # Shift left 0's
0000 1001, 0, 0 # Shift left 1's
0011 0011
0011 0011, 0, 0 # Start
0011 0011, 0, 0 # Shift right till odd
0000 1100, 2, 2 # Shift right till even
0000 1101, 2, 1 # Set LSB
0001 1010, 1, 1 # Shift left 0's
0011 0101, 0, 0 # Shift left 1's