• en

Module Bi_vint

type uint = int
Unsigned int. Note that ints (signed) and uints use the same representation for integers within [0, max_int].
val uvint_of_uint : ?buf:Bi_outbuf.t -> uint -> string
Convert an unsigned int to a vint.
buf existing output buffer that could be reused by this function instead of creating a new one.
val svint_of_int : ?buf:Bi_outbuf.t -> int -> string
Convert a signed int to a vint.
buf existing output buffer that could be reused by this function instead of creating a new one.
val uint_of_uvint : string -> uint
Interpret a vint as an unsigned int.
Raises Bi_util.Error if the input string is not a single valid uvint that is representable using the uint type.
val int_of_svint : string -> int
Interpret a vint as a signed int.
Raises Bi_util.Error if the input string is not a single valid svint that is representable using the int type.
val write_uvint : Bi_outbuf.t -> uint -> unit
Write an unsigned int to a buffer.
val write_svint : Bi_outbuf.t -> int -> unit
Write a signed int to a buffer.
val read_uvint : Bi_inbuf.t -> uint
Read an unsigned int from a buffer.
Raises Bi_util.Error if there is no data to read from or if the uvint is not representable using the uint type.
val read_svint : Bi_inbuf.t -> int
Read a signed int from a buffer.
Raises Bi_util.Error if there is no data to read from or if the svint is not representable using the int type.