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 |
#1034 in Encoding
1,228 downloads per month
Used in 15 crates
(2 directly)
18KB
457 lines
fastvlq
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
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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
~235–375KB