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

Method write_bit

nodedb-codec/src/double_delta.rs:52–62  ·  view source on GitHub ↗
(&mut self, bit: bool)

Source from the content-addressed store, hash-verified

50 }
51
52 pub(crate) fn write_bit(&mut self, bit: bool) {
53 let byte_idx = self.bit_pos / 8;
54 let bit_idx = 7 - (self.bit_pos % 8);
55 if byte_idx >= self.buf.len() {
56 self.buf.push(0);
57 }
58 if bit {
59 self.buf[byte_idx] |= 1 << bit_idx;
60 }
61 self.bit_pos += 1;
62 }
63
64 pub(crate) fn write_bits(&mut self, value: u64, num_bits: usize) {
65 for i in (0..num_bits).rev() {

Callers 4

write_bitsMethod · 0.80
encode_dodFunction · 0.80
encode_timestamp_dodMethod · 0.80
encode_value_xorMethod · 0.80

Calls 2

lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected