Stack-based arbitrary-precision integers - Fast and portable with natural syntax for resource-restricted devices.
Go to file
Mamy Ratsimbazafy 1749e0e575
[WIP] Division and multiplication optimization (#21)
* Clean-up code, part 1

* Managed to get best borrow code for the not inlined substraction #10

* Implement in place substraction in terms of substraction #10

* Another unneed proc removal/temporary step

* more cleanup

* Upgrade benchmark to Uint256

* Special case when divisor is less than halfSize x2 speed 🔥 (still 4x slower than ttmath on Uint256)

* Division: special case if dividend can overflow. 10% improvement.

* forgot to undo normalization (why did the test pass :??)

* 1st part, special cases of fast division

* Change bitops, simplify bithacks to detect new fast division cases

* 25% speed increase. Within 3x of ttmath

* Reimplement multiplication with minimum allocation

* Fix call. Now only 2x slower than ttmath

* Prepare for optimizing comparison operators

* Comparison inlining and optimization. 25% speed increase. 50% slower than ttmath now 🔥

* Fix comparison, optimize one()

* inline initMpUintImpl for another 20% speed. Only 20% slower than ttmath without ASM
2018-04-21 12:12:05 +02:00
benchmarks [WIP] Division and multiplication optimization (#21) 2018-04-21 12:12:05 +02:00
src [WIP] Division and multiplication optimization (#21) 2018-04-21 12:12:05 +02:00
tests [WIP] Division and multiplication optimization (#21) 2018-04-21 12:12:05 +02:00
.appveyor.yml Add continuous integration 2018-02-16 11:45:45 +01:00
.gitignore initial commit 2018-02-15 13:11:01 +01:00
.travis.yml Use Status docker for continuous integration 2018-03-26 11:48:21 +02:00
LICENSE-APACHEv2 Relicense under dual Apache/MIT 2018-03-02 11:48:08 +01:00
LICENSE-MIT Relicense under dual Apache/MIT 2018-03-02 11:48:08 +01:00
README.md Relicense under dual Apache/MIT 2018-03-02 11:48:08 +01:00
mpint.nimble Make bits part of type (#6) 2018-03-26 11:46:24 +02:00

README.md

Mpint (Multi-precision integers)

Build Status (Travis) License: Apache License: MIT Stability: experimental

A fast and portable multi-precision integer library in pure Nim

Main focus:

  • no heap/dynamic allocation
  • uint256 for cryptographic and ethereum blockchain usage.
  • ARM portability for usage on mobile phones
  • Ease of use:
    • casting to and from array of bytes
    • converting to and from Hex
    • converting to and from decimal strings

License

Licensed under either of

at your option.