| Crates.io | packed-integers |
| lib.rs | packed-integers |
| version | 0.2.0 |
| created_at | 2020-11-05 10:58:11.132193+00 |
| updated_at | 2023-09-04 07:34:26.163461+00 |
| description | A growable array for integer types in the range `u1` to `u31`. |
| homepage | |
| repository | https://github.com/adrianwong/packed-integers |
| max_upload_size | |
| id | 308855 |
| size | 38,282 |
packed_integers provides a growable array for integer types in the range u1 to u31.
Assume you have a sequence of unsigned integers in the range [0, 100000] that you would like to
hold in memory. That range of values can be represented using 17 bits per integer, since
217 - 1 = 131071. As Rust has no u17 type, you would typically store these values
in a u32 array, wasting 15 bits per integer.
packed-integers helps alleviate this issue by packing these integers at the bit level,
essentially trading time for space.
Where possible, packed-integers mimics the API for Rust's Vec in order to provide a set of
methods you're probably already familiar with.