Commit Graph

11 Commits

Author SHA1 Message Date
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