35 Commits

Author SHA1 Message Date
jangko
6480939dcd
conversion between big integers 2023-06-20 14:59:26 +07:00
jangko
13a9d31f9a
rename imp to impl 2023-06-15 14:31:59 +07:00
jangko
747978e1e5
fix misleading comments 2023-06-15 14:08:27 +07:00
jangko
41bfed6bb7
io test 2023-06-14 22:26:44 +07:00
jangko
c748d9afb7
fix style type 2023-06-14 09:52:56 +07:00
jangko
fb797d225e
signed int initialization 2023-06-13 19:51:49 +07:00
jangko
76b2baad6f
signed int signedness 2023-06-13 19:09:43 +07:00
jangko
7ce536423a
disable dot borrow temporary 2023-06-13 08:15:04 +07:00
jangko
0dc6afe9d4
let the tests compileable and run 2023-06-12 21:07:15 +07:00
jangko
63a32129c8
rebase and try to make it works with clients 2023-06-12 20:26:36 +07:00
Mamy Ratsimbazafy
27e9c9e441
Add randomized testing, harden against edge cases 2023-06-12 17:12:43 +07:00
Mamy Ratsimbazafy
4660dfe4a4
Use littleEndian for limb-endianness: bigEndian arch are very rare, untestable in CI, a pain to maintain and an intermediate serialization step instead of casting is cheap 2023-06-12 17:11:14 +07:00
Mamy Ratsimbazafy
53d2fd14f3
uint division - compile and pass the single limb tests 2023-06-12 17:11:13 +07:00
Mamy André-Ratsimbazafy
f952314c21
dump progress 2023-06-12 17:08:22 +07:00
Mamy André-Ratsimbazafy
dd3ab71029
For division we need internal add/sub/shift/bitwise so create internal files [skip-ci] 2023-06-12 17:08:21 +07:00
Mamy André-Ratsimbazafy
2ac1ee3f1e
Fix compiletime primitives to pass all bitwise tests except large shifts 2023-06-12 17:08:20 +07:00
Mamy André-Ratsimbazafy
7f6c588ce3
Passing addition tests (however simple bitwise ops crash the int128 VM ... during compilation) 2023-06-12 17:08:20 +07:00
Mamy André-Ratsimbazafy
a0dec54c12
Implement multiplication 2023-06-12 17:08:20 +07:00
Mamy André-Ratsimbazafy
206ffa92cf
Implement multiprecision addition / substraction 2023-06-12 17:08:19 +07:00
Mamy André-Ratsimbazafy
cbbffe4e9c
reimplement bitwise 2023-06-12 17:08:19 +07:00
Mamy André-Ratsimbazafy
36cc2b2e02
Implement comparison 2023-06-12 17:08:19 +07:00
Mamy André-Ratsimbazafy
de87739635
Implement types and uint128 primitives 2023-06-12 17:08:19 +07:00
Jacek Sieka
c05f75a8da
comment style fix 2022-04-07 09:53:11 +02:00
Timothee Cour
484031fdff fix stint for https://github.com/nim-lang/Nim/pull/18050 2021-07-01 13:16:07 +03:00
andri lim
21dc4c6519 compile time truncate and dumpHex 2019-10-23 21:55:47 +09:00
Jacek Sieka
c5247e9d88
stew updates (#82)
* simplify int api (fixes #68)
* implement endians api
* implement some more bitops
2019-07-22 09:53:58 +02:00
Jacek Sieka
360d01d170 Better bitsof implementation (#74)
See https://github.com/nim-lang/Nim/issues/9494
2019-01-07 20:11:45 +01:00
mratsim
308ed51d59 Add 8192-bit overloads 2018-12-04 15:42:00 +01:00
mratsim
fa37d957e9 Add one more bitsof overload to support Uint4096 2018-12-04 14:33:19 +01:00
Jacek Sieka
edb1ade373
add a few more overloads for calculating bitset size (for eth-bloom) 2018-11-07 09:18:25 -06:00
Jacek Sieka
9027fbea3e
refactoring away for loop macros
* remove experimental for loop macro usage
* make implementation of several operations follow data structure
(recursive data -> recursive implementation)
* rename getSize -> bitsof to avoid bits vs bytes confusion
* fix potential 32-bit issue where asSignedWords cast to `int` even when
`uint64` was used as storage
* `hi` for signed ints now is signed - this replaces `asSignedWords` and
makes several int operations more natural
* fix bit size assert
2018-10-25 12:58:40 +02:00
mratsim
65729901db Review: add comment about where Stint is not ideal 2018-10-08 21:11:06 +00:00
mratsim
5980477e0b Add a description and why choosing a recursive impl for Stint 2018-10-08 21:11:06 +00:00
mratsim
7fa6329d4c Change the test flag from mpint_test to stint_test 2018-10-08 21:11:06 +00:00
Yuriy Glukhov
ad09fe3a94 Corrected package structure 2018-05-08 17:42:42 +03:00