Commit Graph

13 Commits

Author SHA1 Message Date
Mamy Ratsimbazafy 6eeba3d41a
Division: Fix recursive divide-and-conquer (#20)
* Simplify div2n1n

* Revert borrow detection, needed a cleverer scheme.

* Getting inspired by uint128 didn't work for recursive. Use recursive algo from the get go

* Fix shl bug ... (need fuzzy testing)

* divmod fixed for single nesting (?)

* Almost there

* Fix one part of div3n2n

* Division is wooorrrrkkinnnggg 🔥

* Fix compilation for the nested version

* forgot to not multiply by 8 the size

* Add another failing shift test

* Fix countLeadingZero for nested uint

* Cleanup: remove debugecho

* Move debug utils in a specific folder

* Fix forward declaration

* Move division it's own file
2018-04-20 11:13:47 +02:00
Mamy Ratsimbazafy 24bd2fc986
Recursive init + bitwise as test + fix shr (#9)
* Recursive init compiles

* fix bitshift. Missing rolling over

* Strange shift required

* debug msg leftover
2018-03-28 20:45:39 +02:00
Mamy Ratsimbazafy c8190df152
Faster division algorithm (#8)
* cosmetic changes

* fix zero conversion

* Div using divided and conquer algorithm. (Compiles but doesn't work)

* Passes test with production flag
2018-03-28 17:15:36 +02:00
Mamy Ratsimbazafy 3a1e5b1151
Make bits part of type (#6)
* Small reorg of conversion proc

* Rework with bits as type. Pass endianess test

* tests_comparison compiles and succeed

* Fix init with int for mpint_test compilation flag

* All tests green 🔥
2018-03-26 11:46:24 +02:00
mratsim 8b8f2a55c4 Relicense under dual Apache/MIT 2018-03-02 11:48:08 +01:00
mratsim 6fd471f243 Add division test + consistent Subtype conversion use 2018-02-17 12:44:51 +01:00
mratsim 834ff19a25 Add comparison operators + tests + fix shr forward declaration 2018-02-16 17:48:54 +01:00
mratsim 35e80263a3 Add shift operators (WIP recursive implementation is slow) 2018-02-16 13:54:38 +01:00
mratsim d60419a731 Karatsuba: shift constant was hardcoded + Add full overflow tests 2018-02-16 09:40:21 +01:00
mratsim 02be5c3e90 [WIP] Add multiplication with Karatsuba algorithm + basic test 2018-02-16 09:22:23 +01:00
mratsim 4d7d5897cd Add substraction implementation 2018-02-15 23:28:31 +01:00
mratsim fc6483d42e Implement addition (including proper overflow behaviour) 2018-02-15 20:26:10 +01:00
mratsim 6f77899709 Add basic data structure, initialization and endianess test 2018-02-15 15:01:08 +01:00