Optimize reduction modulo a power of two