Commit Graph

59 Commits

Author SHA1 Message Date
Jacek Sieka a8418ac2e9
Merge branch 'master' into ct-fixes 2024-05-23 16:23:04 +02:00
Eugene Kabanov e639ba700c
Make decimal string parser raise ValueError instead of RangeDefect. (#148)
* Fix decimal parser helper to raise ValueError instead of RangeDefect.

* Get some fixes in place.
2024-02-27 02:36:02 +02:00
Jacek Sieka 0101f4c449
fix compile-time hash, port to unittest2
* enable compile-time testing for most of the test suite (some parts
that were skipping things turned out to be bugs)
* port to unittest2 and use its recent compile-time testing support
2023-09-27 10:55:57 +02:00
jangko ea02d7db68
more custom literal tests and overflow check 2023-07-07 17:57:14 +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 19e0ac6268
export toBytesBE, toBytesLE 2023-06-21 15:25:29 +07:00
jangko 3ef8d0027a
add fromDecimal to io 2023-06-20 21:39:37 +07:00
jangko 867739d2ca
more endians2 implementation and tests 2023-06-20 19:45:49 +07:00
jangko 80ccea2643
fix conversion raises, inlining, and min/max test 2023-06-20 18:27:17 +07:00
jangko 6480939dcd
conversion between big integers 2023-06-20 14:59:26 +07:00
jangko 4a3f300bd6
fix stuint truncate on 32bit platform 2023-06-19 18:27:49 +07:00
jangko 140afc31ab
fix stuint truncate 2023-06-19 17:20:54 +07:00
jangko 13a9d31f9a
rename imp to impl 2023-06-15 14:31:59 +07:00
jangko c6422a9439
fix signed integer truncate for 32 bit platform 2023-06-15 13:10:58 +07:00
jangko 41bfed6bb7
io test 2023-06-14 22:26:44 +07:00
jangko 1ce276db1e
bug 92 workaround 2023-06-14 13:22:52 +07:00
jangko c748d9afb7
fix style type 2023-06-14 09:52:56 +07:00
jangko f2959e5135
signed int bitwise 2023-06-13 22:17:43 +07:00
jangko f07f574944
fix comparison 2023-06-13 20:39:22 +07:00
jangko 76b2baad6f
signed int signedness 2023-06-13 19:09:43 +07:00
jangko e5c352fde2
fix stuint constructor 2023-06-13 08:13:39 +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 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 André-Ratsimbazafy 777a84e9f5
Implement toHex/fromHex and fix `shl` 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
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 49d11d61b8
RangeError are actually defect and not catchable. (#111)
* RangeError are actually defect and not catchable.

* Don't use range types at runtime they throw RangeDefect
2021-10-08 10:08:56 +02: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 f0da0406f0 tidying up range check in constructor 2019-12-13 16:19:41 +02:00
andri lim d98b77c88d fixes #94, implement conversion constructor 2019-12-13 16:19:41 +02:00
andri lim 7dc26bb714 signed integer 'fromHex' 2019-10-23 21:55:47 +09:00
andri lim 79dfae7d32 fixes typo 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
andri lim affbe30b41 implement compile time helpers 2019-10-23 21:55:47 +09: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
Ștefan Talpalaru 6853ebe97c
assert() -> doAssert() 2019-03-14 03:43:51 +01: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 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 0f5fd20679 NEP-1 (camelCase) 2018-10-08 21:11:06 +00:00
mratsim eb6357f4d1 Misse double hash for doc comments 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
mratsim 7bbe7d8f9f Fix doc of toInt/toUint + add more docs about undefined behaviours 2018-10-08 21:11:06 +00:00
mratsim 69b5630de1 Use static default argument fix #40 and deprecated significantBytesBE 2018-10-08 21:11:06 +00:00
mratsim 31101a5c5b Add a toUint64 and toInt64 for 32-bit platform (fixes #48) 2018-10-08 21:11:06 +00:00