2 ms·
But this compiler will add unneeded bounds checking (3-10% perf. hit). A computed goto table would fix that. (on modern compilers). Anyway, Lemire's fastrange
by rurban 10y ago
But this compiler will add unneeded bounds checking (3-10% perf. hit). A computed goto table would fix that. (on modern compilers).
Anyway, Lemire's fastrange modulo solved that problem better.
https://github.com/lemire/fastrange https://github.com/lemire/fastrange
There's no need for a slow modulo.