varints

A variable length integer encoding implementation inspired by SQLite.

Unstable API.

Consts

maxVarIntLen = 9
the maximal number of bytes a varint can take   Source Edit

Procs

proc readVu64(z: openArray[byte]; pResult: var uint64): int {...}{.raises: [], tags: [].}
  Source Edit
proc writeVu64(z: var openArray[byte]; x: uint64): int {...}{.raises: [], tags: [].}
Write a varint into z. The buffer z must be at least 9 characters long to accommodate the largest possible varint. Returns the number of bytes used.   Source Edit
proc encodeZigzag(x: int64): uint64 {...}{.inline, raises: [], tags: [].}
  Source Edit
proc decodeZigzag(x: uint64): int64 {...}{.inline, raises: [], tags: [].}
  Source Edit