Hi!
I'm happy to announce the first public release of intops—a library that aims to become the single source of truth when it comes to integer arithmetic: in bigint libs, cryptography, and what not.
Intops offers optimized versions of addition, subtraction, multiplication, division, and several composite operations (mulAdd and the likes). The operations are offered in several flavors: overflowing, saturating, carrying, etc.
There are several implementations for most operations, best-tailored for different CPUs, OSes, and C compilers. There are version in pure Nim, C, ASM, and using C intrinsics.
While you can pick an implementation manually, there's a public API that picks the best implementation for the current environment. "Best" in this context means the most performant. All implementations are benchmarked against each other in various environments: https://github.com/vacp2p/nim-intops/actions/workflows/bench.yml
Check the docs for more info: https://vacp2p.github.io/nim-intops/
Feel free to ask questions here on the forum and submit issues in the repo: https://github.com/vacp2p/nim-intops/issues
intops is now fully covered with benchmarks that anyone can check: https://bencher.dev/console/projects/nim-intops/perf
For a library like intops, performance is a key feature, so continuous benchmarks are a must. I'm really happy bencher.dev exists and I can upload the benchmark resutlts there for performance tracking and plotting.