I found in this crate, the number of leading zeros is encoded in 6 bits where the control bit is '11'. However, according to Gorilla's paper, it should be encoded in 5 bits.
(b) (Control bit ‘1’) Store the length of the number of leading zeros in the next 5 bits, then store the length of the meaningful XORed value in the next 6 bits. Finally store the meaningful bits of the XORed value.
The corresponding codes are here.
|
// if the number of leading and trailing zeroes in this xor are not less than the |
|
// leading and trailing zeroes in the previous xor then we store a control bit and |
|
// use 6 bits to store the number of leading zeroes and 6 bits to store the number |
|
// of significant digits before storing the significant digits themselves |
|
|
|
self.w.write_bit(Bit::One); |
|
self.w.write_bits(u64::from(leading_zeroes), 6); |
|
self.leading_zeroes = self.r.read_bits(6).map(|n| n as u32)?; |
Is there a specific reason to use 6 bits for the leasing zeros in this crate?
I found in this crate, the number of leading zeros is encoded in 6 bits where the control bit is '11'. However, according to Gorilla's paper, it should be encoded in 5 bits.
The corresponding codes are here.
tsz-rs/src/encode/std_encoder.rs
Lines 132 to 138 in b3e2dce
tsz-rs/src/decode/std_decoder.rs
Line 143 in b3e2dce
Is there a specific reason to use 6 bits for the leasing zeros in this crate?