better 32-bit code, now to try for a better 64-bit loop
faster implementation