#quantity #variant #variable-length #focus #speed #encode #byte

no-std fastvlq

A fast variant of Variable-Length Quantity with a focus on speed and no_std support

5 releases (3 stable)

1.1.1 Aug 31, 2021
1.0.0 Apr 20, 2021
1.0.0-alpha.2 Oct 11, 2020
1.0.0-alpha.1 Oct 8, 2020

#1530 in Encoding

Download history 25/week @ 2023-12-15 3/week @ 2023-12-22 10/week @ 2023-12-29 13/week @ 2024-01-05 3/week @ 2024-01-12 26/week @ 2024-01-19 6/week @ 2024-01-26 40/week @ 2024-02-02 8/week @ 2024-02-09 34/week @ 2024-02-16 39/week @ 2024-02-23 32/week @ 2024-03-01 32/week @ 2024-03-08 42/week @ 2024-03-15 18/week @ 2024-03-22 68/week @ 2024-03-29

166 downloads per month
Used in 5 crates (via box-format)

Apache-2.0 OR MIT

18KB
457 lines

fastvlq

Actions Status Documentation

Encode and decode with a variant of variable-length quantity data.

The algorithm uses leading zeros to count how many bytes are required for decoding.

Usage

Add this to your Cargo.toml:

[dependencies]
fastvlq = "1"

Where is this used?

  • box - a modern replacement for the zip file format

License

Licensed under either of

at your option.


lib.rs:

Algorithm

Fast VLQ is a variant of value-length quantity encoding, with a focus on encoding and decoding speed. The total number of bytes can always be derived from the very first byte, and unlike VLQ, the integer type supported is u64 exclusively, and will take up a maximum of 9 bytes (for values greater than 56-bit).

This crate does not enforce an invariant that a number may only have one representation, which means that it is possible to encode 1 as, for example, both 0b1000_0001 and 0b0100_0000_0000_0001.

Usage

Add this to your Cargo.toml:

[dependencies]
fastvlq = "1"

Dependencies

~300–445KB