Initial thought, very very ugly

A more reasonable solution should be iteratively shift low bits of
original integer to higher bits of the new one.