Additional bytevector utilities.
Retrieve a 16-bit unsigned integer value from the given bytevector
bv
at offset i
, in little-endian order.
Retrieve a 16-bit unsigned integer value from the given bytevector
bv
at offset i
, in big-endian order.
Retrieve a 32-bit unsigned integer value from the given bytevector
bv
at offset i
, in little-endian order.
Retrieve a 32-bit unsigned integer value from the given bytevector
bv
at offset i
, in big-endian order.
A BER compressed integer (X.209) is an unsigned integer in base 128, most significant digit first, where the high bit is set on all but the final (least significant) byte. Thus any size integer can be encoded, but the encoding is efficient and small integers don't take up any more space than they would in normal char/short/int encodings.
Convert an unsigned integer n
to a bytevector representing
the base-256 big-endian form (the zero index holds the MSB).
The inverse of integer->bytevector
. Convert a bytevector
representing the base-256 big-endian form (the zero index holds
the MSB) to the corresponding unsigned integer.
Utility to pad a bytevector with zeros. Padding is added to the left so as not to change the big-endian value.
Big-endian conversion, guaranteed padded to even length.