Bit-shifts are a lot less expensive than divison.
In reply to Re^3: How to speed up a nested loop? by apl in thread How to speed up a nested loop? by Xenofur