Use bitops instead of mod/div