varints
nimony/lib/std/varints.nim
A variable length integer encoding implementation inspired by SQLite.
Unstable API.
const maxVarIntLen: int64the maximal number of bytes a varint can take
proc readVu64(z: openArray; pResult: var uint64): int64proc writeVu64(z: var openArray; x: uint64): int64Write 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.
proc encodeZigzag(x: int64): uint64proc decodeZigzag(x: uint64): int64