Implementation of an MSB unsigned variable-size integer.
Unsigned integers are serialized 7 bits at a time, starting with the least-significant bits. The highest bit (msb) in each output byte indicates if there is a continuation byte.
Implementation of an MSB unsigned variable-size integer. Unsigned integers are serialized 7 bits at a time, starting with the least-significant bits. The highest bit (msb) in each output byte indicates if there is a continuation byte. https://github.com/multiformats/unsigned-varint
(decode buffer)
Decode a byte array as a varint value. Returns the decoded value.
This is a shorthand for reading the bytes at the beginning of the array and ignoring any extra data.
Decode a byte array as a varint value. Returns the decoded value. This is a shorthand for reading the bytes at the beginning of the array and ignoring any extra data.
(encode value)
Encode a value as a sequence of varint bytes. Returns the encoded byte array.
Encode a value as a sequence of varint bytes. Returns the encoded byte array.
(read-bytes data offset)
Read bytes from the byte array at the given offset. Returns a tuple with the decoded varint and the number of bytes read.
Read bytes from the byte array at the given offset. Returns a tuple with the decoded varint and the number of bytes read.
(write-bytes value buffer offset)
Write a value as a varint to a byte array at the given offset. Returns the number of bytes written.
Write a value as a varint to a byte array at the given offset. Returns the number of bytes written.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close