Closed nukeykt closed 3 years ago
I think compiler will optimize it to & 31 (even in debug build) because I use unsigned integer. But I don't mind this change.
yeah, at very least visual studio optimizes it to &
in all builds
We still build with Visual C++ 6 from 1998. It doesn't do all the optimizations that modern compilers do, so I think it's good to include it in the code.
Looks good to me.
btw: For uint % 32
, MSVC6 uses mov ecx,20h / div eax,ecx
in Debug mode and and ecx,1Fh
in Release mode.
Interesting, dos era version of watcom compiler did this optimization in debug mode, so I assumed other compilers would do this as well
Debug mode really is not something I would optimize for, though. As long as it performs well in Release mode, that's fine to me.
Looks good to me. Just a small thing, I would prefer if the
%
were changed to&
for speed reasons.