Optimize the floor to shift transform.

Rewrite the parts that could cause overflow on signed or
unsigned words.
TODO: Similar optimisation for ceiling.