pub struct EwahBitmap {
pub bit_size: u32,
pub words: Vec<u64>,
pub rlw_position: u32,
}Fields§
§bit_size: u32§words: Vec<u64>§rlw_position: u32Implementations§
Source§impl EwahBitmap
impl EwahBitmap
Sourcepub fn from_words(bit_size: u32, words: &[u64]) -> Result<Self>
pub fn from_words(bit_size: u32, words: &[u64]) -> Result<Self>
Constructs an EwahBitmap in git’s canonical EWAH compressed form
from a slice of raw uncompressed 64-bit words.
Within each word bit i corresponds to position word_index * 64 + i,
matching git’s on-disk convention. bit_size records the number of
logical bits the bitmap spans; it must not exceed words.len() * 64.
This mirrors libgit’s ewah_add/ewah_add_empty_words incremental
encoder: consecutive all-zero or all-one words collapse into a run, and
any other word is stored verbatim as a literal. Only the first
bit_size.div_ceil(64) words back the declared bits; any extra trailing
words supplied by the caller are ignored, just as git encodes a bitmap
sized to its highest set bit.
Sourcepub fn from_positions(bit_size: u32, positions: &[u32]) -> Result<Self>
pub fn from_positions(bit_size: u32, positions: &[u32]) -> Result<Self>
Constructs an EwahBitmap from a set of bit positions.
bit_size is the number of logical bits (typically the pack object
count). Every position in positions must be strictly less than
bit_size. Positions may be given in any order and may repeat.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
An empty EWAH bitmap (no bits, no words). This is what git writes for an all-zero type bitmap (e.g. when a pack has no tags).
Sourcepub fn to_words(&self) -> Result<Vec<u64>>
pub fn to_words(&self) -> Result<Vec<u64>>
Decodes the compressed EWAH back into raw 64-bit words, LSB-first within
each word. The returned vector has bit_size.div_ceil(64) entries.
This is the inverse of EwahBitmap::from_words for the bits the
bitmap actually covers and is primarily used to validate roundtrips.
Sourcepub fn to_positions(&self) -> Result<Vec<u32>>
pub fn to_positions(&self) -> Result<Vec<u32>>
Returns the sorted set bit positions covered by this bitmap.
Trait Implementations§
Source§impl Clone for EwahBitmap
impl Clone for EwahBitmap
Source§fn clone(&self) -> EwahBitmap
fn clone(&self) -> EwahBitmap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EwahBitmap
impl Debug for EwahBitmap
impl Eq for EwahBitmap
Source§impl PartialEq for EwahBitmap
impl PartialEq for EwahBitmap
Source§fn eq(&self, other: &EwahBitmap) -> bool
fn eq(&self, other: &EwahBitmap) -> bool
self and other values to be equal, and is used by ==.