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

Function encode_validity_bitmap

nodedb-columnar/src/writer/encode.rs:31–40  ·  view source on GitHub ↗

Encode a validity bitmap: ceil(N/8) bytes, bit=0 means null, bit=1 means valid.

(valid: &[bool])

Source from the content-addressed store, hash-verified

29
30/// Encode a validity bitmap: ceil(N/8) bytes, bit=0 means null, bit=1 means valid.
31pub(super) fn encode_validity_bitmap(valid: &[bool]) -> Vec<u8> {
32 let byte_count = valid.len().div_ceil(8);
33 let mut bitmap = vec![0u8; byte_count];
34 for (i, &v) in valid.iter().enumerate() {
35 if v {
36 bitmap[i / 8] |= 1 << (i % 8);
37 }
38 }
39 bitmap
40}
41
42/// Prepend a validity bitmap to compressed data.
43pub(super) fn prepend_validity(valid: &[bool], compressed: &[u8]) -> Vec<u8> {

Callers 2

prepend_validityFunction · 0.85
encode_single_blockFunction · 0.85

Calls 2

lenMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected