Commit Graph

10 Commits

Author SHA1 Message Date
Jacek Sieka 8a405309c6
enable styleCheck:usages (#93) 2021-12-02 16:24:02 +01:00
Jacek Sieka 5cf4feabea
leb128 + bitops fixes (#66)
Leb128 is a variable-length encoding for unsigned integers that is used
in a number of contexts - in particular, wasm, dwarf and protobuf.

This is an optimized low-level implementation that unrolls the loop
reading/writing the buffer - it is suitable to use as base for a more
specific API - no memory allocations, no exceptions.

This PR also fixes bitops2 to not raise on certaing uint->int
conversions, adapting bitops to nim 1.0 conversion rules by using a cast
instead of raising on uint->int conversion
2020-12-15 17:07:20 +02:00
Zahary Karadjov d0f5be4971
Fix a compilation error when using a 32-bit varint parser 2020-05-12 22:59:46 +03:00
Zahary Karadjov c500d3dda1
Some renames to cater to the latest FastStreams API 2020-05-12 15:02:06 +03:00
Zahary Karadjov 8528ce28b4
Writing to FastStreams can have side-effects 2020-04-14 19:36:15 +03:00
Jacek Sieka e9d75c05f6
fix 1.0 test compat 2019-12-10 15:50:02 +01:00
Zahary Karadjov 5f1dc751ca
Convenience varints API going from int straight to openarray 2019-09-08 22:33:03 -04:00
Jacek Sieka a8d98b3e88
fix parser type 2019-08-07 11:39:05 +02:00
Zahary Karadjov 5e11e1f1db
Add BitSeq.isZeros 2019-08-07 05:19:53 +03:00
Zahary Karadjov 6be00f7c4b
Extract the varints code being used in the latest LibP2P back-end
Originally, this code was taken from
https://github.com/status-im/nim-libp2p/blob/master/libp2p/varint.nim

The API was refactored to make it easier to use in the networking
back-ends where the data is being consumed byte by byte.
2019-08-01 17:21:14 +03:00