☰

# std/varints

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

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 decodeZigzag(x: uint64): int64 {.inline, ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc encodeZigzag(x: int64): uint64 {.inline, ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc readVu64(z: openArray[byte]; pResult: var uint64): int {....raises: [],
        tags: [], forbids: [].}

  Source Edit

    proc writeVu64(z: var openArray[byte]; x: uint64): int {....raises: [], tags: [],
        forbids: [].}

  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