Commit Graph

30 Commits

Author SHA1 Message Date
jangko d198ec031e
test against intx library 2023-07-07 19:36:50 +07:00
jangko e374311f70
add custom literal feature 2023-07-07 13:22:22 +07:00
jangko 3e9d64c896
fix skipPrefixes bug 2023-07-07 12:56:30 +07:00
jangko 7fc30a8f1c
enable randomized divmod tests 2023-06-23 09:31:27 +07:00
jangko 6480939dcd
conversion between big integers 2023-06-20 14:59:26 +07:00
jangko 41bfed6bb7
io test 2023-06-14 22:26:44 +07:00
jangko 79ad349fb5
cleanup tests 2023-06-14 09:41:01 +07:00
jangko 1657d841e7
cleanup some code 2023-06-14 08:06:44 +07:00
jangko f2959e5135
signed int bitwise 2023-06-13 22:17:43 +07:00
jangko 0dc6afe9d4
let the tests compileable and run 2023-06-12 21:07:15 +07:00
Mamy Ratsimbazafy 27e9c9e441
Add randomized testing, harden against edge cases 2023-06-12 17:12:43 +07:00
andri lim d98b77c88d fixes #94, implement conversion constructor 2019-12-13 16:19:41 +02:00
andri lim 523b74d0d2 add endians2 test into all_tests 2019-10-23 21:55:47 +09:00
andri lim ccf87daac1 implement arithmetic right shift (#76)
* implement arithmetic right shift

* workaround Nim VM 'cast' limitation

* fix high(stint) bug

* fix compile time bit shift bug

* add test for compile time shift and high(stint)

* add tests against ttmath
2019-05-11 15:44:41 +02:00
Jacek Sieka 9c51f9e7d5 use bitops2 from shims (#77) 2019-05-09 21:46:40 +02:00
mratsim 7591373f15 Enable modular arithmetic tests 2018-10-08 21:11:06 +00:00
mratsim 582466b625 Fix Generic Instantiation too nested in unittest (https://github.com/status-im/nim-stint/pull/66#issuecomment-427557655) + Renable all tests 2018-10-08 21:11:06 +00:00
mratsim f7fcecb395 Export marker + assign to result.data + fix forward decl and visibility issues introduced by the removal of the templates 2018-10-08 21:11:06 +00:00
Mamy Ratsimbazafy fd0482180f
Add bigint serialization (hex and decimal) (#29)
* Add serialization for decimal and hex

* Fix carry bug in signed add

* Add parsing test

* Improve highlow for int, remove most_significant_word_mut

* make conversion toString compile

* Add division corner case test

* Remove a buggy division shortcut

* Fix decimal string conversion

* Fix hex dumping

* Fix power of 2 division (what was I thinking?)

* Add hexdump test

* Move runtime check to compile-time

* Fix static assert check

* more compile-time asserts

* Fix parsing of negative hex numbers, add test_io to the suite

* dump default to bigEndian, split toString in Stint and Stuint

* Add (failing) tests with big ints conversion

* Temporarily remove all the noInit pragma
2018-04-30 13:38:55 +02:00
mratsim 6d2562ff5f Implement absolute value and signed modulo/division 2018-04-26 12:27:02 +02:00
mratsim 37ebd13dd4 Implement add, sub, neg with proper overflow detection 2018-04-25 21:21:58 +02:00
mratsim e2ab2dbf59 Add signed word iteration 2018-04-25 17:02:44 +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
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 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