1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! An implementation of the shared parts of git bitmaps used in `gix-pack`, `gix-index` and `gix-worktree`.
//!
//! Note that many tests are performed indirectly by tests in the aforementioned consumer crates.
//!
//! ## Examples
//!
//! ```
//! let encoded = [
//! 0, 0, 0, 64, // 64 bits in total
//! 0, 0, 0, 2, // two u64 words follow
//! 0, 0, 0, 2, 0, 0, 0, 0, // one RLW word with one literal word
//! 0, 0, 0, 0, 0, 0, 0, 21, // literal bits 0, 2 and 4 set
//! 0, 0, 0, 0, // RLW points at the first word
//! ];
//!
//! let (bitmap, rest) = gix_bitmap::ewah::decode(&encoded).unwrap();
//! let mut set_bits = Vec::new();
//! bitmap.for_each_set_bit(|idx| {
//! set_bits.push(idx);
//! Some(())
//! });
//!
//! assert!(rest.is_empty());
//! assert_eq!(bitmap.num_bits(), 64);
//! assert_eq!(set_bits, vec![0, 2, 4]);
//! ```
/// Bitmap utilities for the advanced word-aligned hybrid bitmap
pub