The variable length integer encoding of u64. This is a simple and fast encoder/decoder.
| Prefix | Precision | Total Bytes |
|------------|-----------|-------------|
| 0xxxxxxx
| 7 bits | 1 byte |
| 10xxxxxx
| 14 bits | 2 bytes |
| 110xxxxx
| 21 bits | 3 bytes |
| 1110xxxx
| 28 bits | 4 bytes |
| 11110xxx
| 35 bits | 5 bytes |
| 111110xx
| 42 bits | 6 bytes |
| 1111110x
| 49 bits | 7 bytes |
| 11111110
| 56 bits | 8 bytes |
| 11111111
| 64 bits | 9 bytes |
This format is a like vint64
,
but 0x00 is represented by 0x00.
```rust use vu64::encode;
asserteq!(encode(0x0f0f).asref(), &[0x8F, 0x3c]); ```
```rust use vu64::decode;
let slice = [0x8F, 0x3c].asref(); asserteq!(decode(slice).unwrap(), 0x0f0f); ```
```rust use vu64::{encode, decode};
let val = 1234; asserteq!(decode(encode(val).asref()).unwrap(), val); ```
This project is licensed under either of
at your option.