Commit Graph

190 Commits

Author SHA1 Message Date
mratsim 31101a5c5b Add a toUint64 and toInt64 for 32-bit platform (fixes #48) 2018-10-08 21:11:06 +00:00
mratsim 1c29314d8e Add a touint proc fixes #58 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
mratsim ede5b57fa4 Improve uint public API: no template + documentation 2018-10-08 21:11:06 +00:00
Jacek Sieka 8c97a4b6c0
nimble: remove nimcache options 2018-10-04 12:36:52 -06:00
Yuriy Glukhov cb442fa315
Merge pull request #64 from status-im/push-experimental
Push experimental
2018-09-06 20:32:30 +03:00
Jacek Sieka 5747485c83
appveyor: try different way of comparing versions 2018-09-06 10:28:50 -06:00
Yuriy Glukhov f76c0ee1ea Removed experimental flag 2018-09-06 13:37:00 +03:00
Yuriy Glukhov 4e7dc9397c Push experimental 2018-09-06 12:35:12 +03:00
Jacek Sieka 7ac41ab671
readme: update license 2018-09-05 12:48:40 -06:00
Jacek Sieka ecf528e69b
ci: update
readme: fix license, badges
2018-09-04 23:09:11 -06:00
Jacek Sieka cae8888ff5
travis: use cached nim instead of docker 2018-09-02 19:48:46 -06:00
mratsim 7e0289fbdf Fix regression due to when bool restriction 361a2d830a and https://github.com/nim-lang/Nim/issues/7375 2018-08-24 13:34:29 +02:00
Mamy Ratsimbazafy bd734b6845
Don't use stint's nim.cfg during CI to compile koch (#63)
* Don't use stint's nim.cfg during CI to compile koch

* skip both project and parentcfg?

* reorder switches

* everything should skip the cfg

* Use .nimble switch - nim.cfg causes problem when updating packages

* remove the skip compile flags
2018-08-21 14:19:39 +02:00
Mamy Ratsimbazafy fc27e86061
New {.experimental: "ForLoopMacros".} support (#62)
* Bug https://github.com/nim-lang/Nim/issues/8676 and da41fc1801

* Use a commandline flag
2018-08-20 10:34:28 +02:00
mratsim 215293756a Use the new {.experimental.} pragma. Fix https://github.com/nim-lang/Nim/issues/8676, linked to da41fc1801 2018-08-17 19:34:10 +02:00
coffeepots 2a85ed2e40 Fix multiplication on 32 bit systems (#60) 2018-08-10 08:37:04 +02:00
Luke Parker d6435b37ef Stop single digit strings from throwing an IndexError on `parse` (#59) 2018-08-05 23:47:05 +02:00
Zahary Karadjov 406f1aa317 Added a fromHex helper in the style of the new fromBytes APIs 2018-07-04 18:37:07 +03: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
Mamy Ratsimbazafy 36ec850c4f
Compile time signed ints (#55)
* Refactor asSignedWords, kill 130+ lines

* Allow signed int initialization at compiletime.

* inline procs in uint_mul

* Fix an unfortunate shadowing in high(Int)
2018-06-18 16:44:29 +02:00
Mamy Ratsimbazafy a46c62bc83
Uint - allow compile-time evaluation for all procs (#54)
* Initial commit - allow all ops at compile-time on uint.

* Update benchmark

* Delete commented ideal version of asWordsiterate, it  is obvious from the workaround (and is tracked in the PR)
2018-06-18 12:54:25 +02:00
Mamy Ratsimbazafy 184e22b659
Compile-time creation of Uint (#53)
* Start on allowing compile-time stint. Works for Uint256

* remove and reorder initUintImpl, zero and one procs

* Fix assignation of uint64 to 2xuint32, remove unsafeConv and use const for base/radix

* assign_least_significant_words shouldn't implicitly capture result

* Simplify least significant words macros
2018-06-16 18:54:40 +02:00
Mamy Ratsimbazafy 35c57de63d
lenient_stint, typo stuint vs stint in signed conversion 2018-06-14 18:42:58 +02:00
Mamy Ratsimbazafy 46e0810bd3
Add optional mixed types syntactic sugar (#49)
* Add optional mixed types syntactic sugar

* Rename to lenient_stint - remove literals specialization
2018-06-14 15:53:55 +02:00
mratsim fac7c8db3c Comment out test-only dependencies quicktest and ttmath.
(Repeated annoying "Dependency for ttmath: do you want to replace byteutils" while compiling nimbus)
2018-06-10 13:11:24 +02:00
Mamy Ratsimbazafy 7707a4b40f
Add overloads for literals only (#50) 2018-05-31 14:31:27 +02:00
Mamy Ratsimbazafy 8e25b30209
fix highest signed int comment 2018-05-17 09:45:42 +02:00
Mamy Ratsimbazafy c588a84f19
wrong variable net only_msb_set to only_msb_unset in high(IntImpl) 2018-05-17 09:43:41 +02:00
Mamy Ratsimbazafy f2d0eab153
Modular arithmetic (#47)
* Add isEven and isOdd functions

* Add modular add, mul, sub pow fixes #18
2018-05-16 10:41:46 +02:00
mratsim 7c11f7da07 add `$` alias for toString 2018-05-15 11:51:59 +02:00
mratsim 1283d582a1 implement a pow for x, y: UintImpl as well 2018-05-14 19:44:39 +02:00
Mamy Ratsimbazafy 11f62d42c9
Add exponentiation - closes #37 (#46)
* Add exponentiation

* Change name to pow (like ttmath) - `^` to discuss
2018-05-14 19:02:39 +02:00
Yuriy Glukhov 4e0724790c
Merge pull request #44 from status-im/pkg-struct
Corrected package structure
2018-05-08 20:57:37 +03:00
Yuriy Glukhov ad09fe3a94 Corrected package structure 2018-05-08 17:42:42 +03:00
mratsim 0ad3239907 Fix #45 - shl/shr "halfSize" should have the same type as the input 2018-05-08 16:38:11 +02:00
mratsim 37c969b11e Merge branch 'master' of https://github.com/status-im/nim-stint 2018-05-08 15:47:36 +02:00
mratsim 0209af26a2 Add restrict pragma for readUintBE and toByteArrayBE 2018-05-08 15:47:32 +02:00
Mamy Ratsimbazafy 78b2d5af29
32-bits - use guaranted 64-bit types in VM for mul fix #42 (#43) 2018-05-08 15:31:30 +02:00
mratsim 8cd48fc0e9 Add Appveyor badge + use the blue MIT badge 2018-05-08 15:30:58 +02:00
mratsim 012dcf288c Add toHex shortcut for toString(16) 2018-05-08 14:44:07 +02:00
mratsim c296e14dde Merge branch 'master' of https://github.com/status-im/nim-stint 2018-05-08 13:50:05 +02:00
mratsim 2efaf3e623 Export zero and one proc 2018-05-08 13:49:58 +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 1653a8815f
Restrict pragma: use C, C++, VCC + GCC + LLVM compatible syntax (#41) 2018-05-08 11:46:21 +02:00
mratsim 1b7423eacd Export countLeadingZeroBits 2018-05-06 23:02:50 +02:00
mratsim 7dad3f89d8 Export string parsing shortcut "u256" 2018-05-06 22:41:49 +02:00
mratsim 1ff544eabf Remove the fooPragma placeholder (for noinit) 2018-05-06 22:29:08 +02:00