Okay, I've refined this library a bit more, and now everything is a little better, and in some cases much better than before (thanks to the FPC developers!)
(i7-8750h, laptop)
Unsigned div 32 by const compiler inline: 395 ms, 200000000 iterations
Unsigned div 32 by const compiler: 1001 ms, 200000000 iterations
Unsigned div 64 by const compiler inline: 556 ms, 200000000 iterations
Unsigned div 64 by const compiler: 1016 ms, 200000000 iterations
The results of division by a constant are provided for reference only, as the compiler effectively replaces division by multiplication in such cases. Therefore, comparison with the FastDiv method is only useful for understanding the slowdown it introduces relative to these methods (since it cannot currently be efficiently inlined into the code) and the speedup it provides relative to actual division methods.
Unsigned div 32 native inline: 1284 ms, 200000000 iterations
Unsigned div 32 native: 1881 ms, 200000000 iterations
Unsigned div 64 native inline: 4402 ms, 200000000 iterations
Unsigned div 64 native: 5393 ms, 200000000 iterations
Unsigned div 32 FastDiv: 939 ms, 200000000 iterations
Unsigned div 64 FastDiv: 1100 ms, 200000000 iterations
full 32 bit range div u32:
2% 4% 6% 9% 11% 13% 15% 18% 20% 22% 25% 27% 29% 31% 34% 36% 38% 40% 42% 45% 47% 49% 51% 53% 56% 58% 60% 62% 64% 66% 68% 70% 72% 74% 76% 78% 80% 82% 85% 87% 89% 91% 93% 96% 97% 99% 100%
full 32 bit range div u32:
2% 4% 6% 8% 11% 13% 15% 17% 20% 22% 24% 26% 29% 31% 33% 35% 38% 40% 42% 44% 47% 49% 51% 54% 56% 58% 61% 63% 65% 67% 69% 71% 74% 76% 78% 80% 82% 85% 87% 89% 91% 93% 96% 97% 99% 100%
partially 64 bit range:
2% 4% 6% 8% 10% 12% 15% 17% 19% 21% 23% 25% 27% 29% 32% 34% 36% 38% 40% 42% 44% 47% 49% 51% 53% 55% 57% 59% 59% 59% 60% 60% 61% 61% 61% 62% 62% 63% 63% 64% 64% 64% 65% 65% 66% 66% 67% 67% 68% 68% 68% 69% 69% 70% 70% 71% 71% 72% 72% 72% 73% 73% 74% 74% 74% 75% 75% 76% 76% 77% 77% 78% 78% 78% 79% 79% 80% 80% 81% 81% 81% 82% 82% 83% 83% 84% 84% 85% 85% 86% 86% 86% 87% 87% 88% 88% 89% 89% 90% 90% 90% 91% 91% 91% 92% 92% 93% 93% 93% 94% 94% 95% 95% 95% 96% 96% 97% 97% 98% 98% 98% 99% 99% 99% 100%
TRUE, manual32: 24924924, comp32: 24924924
TRUE, manual32: 00000003, comp32: 00000003
TRUE, manual64: 2492492492492492, comp64: 2492492492492492
TRUE, manual64: 0000000000000001, comp64: 0000000000000001