20 Commits

Author SHA1 Message Date
G
f36623998f
fix(skipPrefixes): fix erroneous strip of 0b in hex numbers (#120)
* fix(skipPrefixes): fix erroneous strip of 0b in hex numbers

* refactor(skipPrefixes): normalize radix checks

* feat(stint): add tests for bin, oct, hex string conversions

* fix(stint): fix cast

* fix(stint): fix typo

* fix(stint): alternative format

* feat(stint): add test

* fix(stint): fix stint width in test
2022-10-03 12:15:45 +02:00
Kim De Mey
e656ad40d1
Enable --styleCheck:usages (#118) 2022-02-24 20:09:53 +01:00
Mamy Ratsimbazafy
06e5c4829c
Parsing should raise CatchableError for user inputs (#110) 2021-10-06 18:53:52 +02:00
zah
9e49b00148 Define a hash function in order to support Stint keys in hash tables (#102)
* Hash stint values as byte blobs; Add a basic test for using stint keys in a table
2019-12-18 14:02:16 +01:00
andri lim
7fe4db62dc add compiletime test for signed int dumphex 2019-10-25 19:54:41 +03:00
andri lim
8cc9116d1e cosmetics changes 2019-10-23 21:55:47 +09:00
andri lim
3189775012 fixes 32bit failure 2019-10-23 21:55:47 +09:00
andri lim
0cd6b2a052 improve io test coverage + compile time test 2019-10-23 21:55:47 +09:00
Ștefan Talpalaru
6853ebe97c
assert() -> doAssert() 2019-03-14 03:43:51 +01:00
mratsim
4fe901d33b Use truncate instead of toInt and co 2018-10-08 21:11:06 +00:00
mratsim
2d6ea71657 BREAKING: Change named param from base to radix in io procs 2018-10-08 21:11:06 +00:00
mratsim
53ceaffdfa Fix endianness issue in toInt64 and toUint64 2018-10-08 21:11:06 +00:00
mratsim
f161454309 Add tests for toUint/toUint64, toInt, toInt64 2018-10-08 21:11:06 +00:00
zah
f05feeb865 Relaxed construction from BE bytes (#57)
* Support automatic padding when constructing values from byte arrays

* add a test case for fromBytesBE
2018-07-04 17:34:14 +02:00
zah
6ae8de932d Add explicit generic conversion operators (#56)
The new `to` operators that can be used to constuct Stint types from
regular integer types. These are intented for usage in generic code
such as rlp.nim

Also fixes a bug preventing construction of Stint values from unsigned
integers (because they lack an unary `-` operator).
2018-06-27 12:18:48 +02:00
mratsim
7c11f7da07 add $ alias for toString 2018-05-15 11:51:59 +02:00
Yuriy Glukhov
ad09fe3a94 Corrected package structure 2018-05-08 17:42:42 +03:00
mratsim
012dcf288c Add toHex shortcut for toString(16) 2018-05-08 14:44:07 +02:00
Mamy Ratsimbazafy
adb75b32b8
[IO]: Add readUintBE, hexToUint, toByteArrayBE
* Add readUintBE and toByteArrayBE proc

* Add readUintBE, hexToUint, to ByteArrayBE and reorder parse arguments + tests
2018-05-08 13:21:04 +02: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