Skip to content

The length of the number of leading zeros probably should be 5 bits #13

Description

@lemolatoon

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions