25 Commits

Author SHA1 Message Date
Jacek Sieka
391c2e24b1
intops: core integer primitives
This, together with bitops2 and endians2, forms the core primitive
offering for working with integers as the computer sees them.

The focus of intops is to expose a number of common integer operations
typically used to build more complex abstractions such as bigints,
mp-ints etc while having access to the best performance the compiler and
cpu can offer.

There is more to do here, but this provides an outline of what this
module could look like.

Obviously, there are no exceptions or defects around - the point of
these utilities is to stay as close as possible to bare metal. They
could be used to implement such features however (similar to how
`system/integerops` works).
2023-05-09 21:28:35 +02:00
Jacek Sieka
447b23d3bf
results: work around field access bugs (#167)
* results: work around field access bugs

See:

* https://github.com/nim-lang/Nim/issues/3770
* https://github.com/nim-lang/Nim/issues/20900

* comment fixes

* add test

* document test better
2023-01-20 15:32:51 +01:00
Jacek Sieka
f295d00db9
remove stew/ranges (#152)
* deprecated for years
* relies on unavailable (shallowCopy) or broken (missing range checks)
features in nim
2022-11-18 12:52:55 +01:00
Tanguy
23da07c9b5
Fix compilation on devel (#146) 2022-10-29 21:48:51 +02:00
tersec
f173efc500
stylecheck: nnkArglist -> nnkArgList (#127)
* stylecheck: nnkArglist -> nnkArgList

* --stylecheck:error iff >= 1.6.0
2022-07-18 11:02:40 +00:00
Jordan Hrycaj
4cab7b0879
Added IntervalSet, sets of non-adjacent intervals (#121)
* Added `IntervalSet`, sets of non-adjacent intervals

Relocated from nimbus-eth1 snap sync development

* Fix local import directive

* Fix --styleCheck complaints

* Attempt to get around CI problem by varying items

details:
  Vary all_tests exec list
  Hide useless globalness of `noisy` constant in non-debugging mode
2022-06-20 15:04:47 +01:00
Zahary Karadjov
a98ec09b0b
Add sets.keepItIf 2021-12-03 13:28:59 +02:00
Zahary Karadjov
7ab114e159
Add templateutils.evalTemplateParamOnce 2021-12-03 13:28:54 +02:00
Jordan Hrycaj
b002c1fad0
New data structures - SortedSet and KeyedQueue
See the modules' documentation for more details
2021-11-04 13:17:50 +02:00
Eugene Kabanov
6bcb21184a
Optimized and exception-less encoding/decoding procedures for decimal integers (#78)
* Optimized and exception-less encoding/decoding procedures for decimal integers.

* Add tests.

* Fix import path.

* Fix review comments.

* Code simplification.

* Make toBytes() allocation free.

* Do not perform conversion to signed type to avoid compiler's overflow checks.
2021-03-05 20:50:36 +02:00
Jacek Sieka
d8d914332d
random helpers (#64)
* random helpers

* arrayops as a home for small array/openArray utilities
* assign2 - a replacement for genericAssign and assignment operators in
general which in nim are very slow
* use assign2 in a few places to speed things up

* fixes

* fixes
2020-12-10 12:05:22 +01:00
Eugene Kabanov
7018fb0b5e
Procedures to set user-only Windows ACL settings for files and folders. (#58)
* Initial commit of UserOnly Windows ACL settings for files and folders.

* Move ACL procedures to windows/acl.
Move ACL tests to test_winacl.nim.

* Add test_winacl.nim

* Fix *nix compilation problem.

* More proper fix for *nix targets.
2020-10-15 14:27:58 +02:00
Eugene Kabanov
7a2b6dbdda
IO2 (#53)
* Initial commit of io2 module

* Rename to io2.
Add createPath with permissions.
Add writeFile with permissions.
Add tests.

* Add test_io2 to all tests.

* Add posix permissions.

* Add toString procedure for set[Permission] and tests.

* Remove safeio.nim

* Add setPermissions procedures.
Fix writeFile() to change permissions.
Add more writeFile() tests.

* Change C ReadOnly/WriteOnly/ReadWrite to pair of Read/Write.
Add tests for openFile.

* File handles is no inherited by default, with option to turn on inheritance.

* Review comments fixes.
More tests.

* Fix x86 compilation problems.

* Rename toSet -> toPermissions.

* Avoid race condition on writeFile permissions.
2020-09-22 08:53:00 +03:00
cheatfate
a5560c1ea6
Add constant isEqual operation for openarrays. 2020-07-29 01:43:09 +03:00
Zahary Karadjov
4ffd3e1f59
Support type hierarchies in recordFields 2020-05-26 18:56:41 +03:00
Jacek Sieka
b06a5b6e32
result -> results (#27) 2020-04-07 11:43:07 +02:00
Ștefan Talpalaru
09e55cd375
stew/objects: add baseType() 2020-03-29 17:34:45 +02:00
Jacek Sieka
f5be0ab63a
add nim-result 2020-01-23 17:35:30 +01:00
Yuriy Glukhov
1c1195dba3 Copied base32, 58, 64 from libp2p 2019-12-13 15:31:19 +02:00
Jacek Sieka
5ada369741 ptrops: add 2019-09-26 18:25:19 +03:00
Zahary Karadjov
2334aa0fb3
More code migrated from the beacon-chain repo 2019-07-31 02:25:12 +03:00
Jacek Sieka
7a87693eaf
refactor bitops2, add endians2 2019-07-06 20:47:08 +02:00
Jacek Sieka
904f84c8e0
add ranges 2019-07-06 20:45:27 +02:00
Jacek Sieka
c95cee45bc
add byteutils 2019-07-06 20:07:41 +02:00
Jacek Sieka
a9612d7320
add docs/appveyor/travis/test runner 2019-07-06 20:00:37 +02:00