MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / bitmap_contains

Function bitmap_contains

nodedb-spatial/src/hybrid.rs:124–132  ·  view source on GitHub ↗

Check if an entry ID is set in a bitmap.

(bitmap: &[u8], id: u64)

Source from the content-addressed store, hash-verified

122
123/// Check if an entry ID is set in a bitmap.
124pub fn bitmap_contains(bitmap: &[u8], id: u64) -> bool {
125 let byte_idx = (id / 8) as usize;
126 let bit_idx = (id % 8) as u32;
127 if byte_idx < bitmap.len() {
128 bitmap[byte_idx] & (1 << bit_idx) != 0
129 } else {
130 false
131 }
132}
133
134#[cfg(test)]
135mod tests {

Callers

nothing calls this directly

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected