diff --git a/datasketches/src/cpc/sketch.rs b/datasketches/src/cpc/sketch.rs index d11d59b..534f0a0 100644 --- a/datasketches/src/cpc/sketch.rs +++ b/datasketches/src/cpc/sketch.rs @@ -97,7 +97,7 @@ impl CpcSketch { /// /// # Panics /// - /// Panics if `lg_k` is not in the range `[4, 16]`. + /// Panics if `lg_k` is not in the range `[4, 26]`. pub fn new(lg_k: u8) -> Self { Self::with_seed(lg_k, DEFAULT_UPDATE_SEED) } @@ -106,7 +106,7 @@ impl CpcSketch { /// /// # Panics /// - /// Panics if `lg_k` is not in the range `[4, 16]`, or the computed seed hash is zero. + /// Panics if `lg_k` is not in the range `[4, 26]`, or the computed seed hash is zero. pub fn with_seed(lg_k: u8, seed: u64) -> Self { assert!( (MIN_LG_K..=MAX_LG_K).contains(&lg_k), diff --git a/datasketches/src/cpc/union.rs b/datasketches/src/cpc/union.rs index 4c68f5a..a983630 100644 --- a/datasketches/src/cpc/union.rs +++ b/datasketches/src/cpc/union.rs @@ -91,7 +91,7 @@ impl CpcUnion { /// /// # Panics /// - /// Panics if `lg_k` is not in the range `[4, 16]`. + /// Panics if `lg_k` is not in the range `[4, 26]`. pub fn new(lg_k: u8) -> Self { Self::with_seed(lg_k, DEFAULT_UPDATE_SEED) } @@ -100,7 +100,7 @@ impl CpcUnion { /// /// # Panics /// - /// Panics if `lg_k` is not in the range `[4, 16]`. + /// Panics if `lg_k` is not in the range `[4, 26]`. pub fn with_seed(lg_k: u8, seed: u64) -> Self { // We begin with the accumulator holding an EMPTY_MERGED sketch object. let sketch = CpcSketch::with_seed(lg_k, seed); diff --git a/datasketches/src/theta/bit_pack.rs b/datasketches/src/theta/bit_pack.rs index 2a59351..013899b 100644 --- a/datasketches/src/theta/bit_pack.rs +++ b/datasketches/src/theta/bit_pack.rs @@ -4974,17 +4974,14 @@ fn unpack_bits_63(values: &mut [u64], bytes: &[u8]) { /// /// * Panics if `values.len()` is not equal to `BLOCK_WIDTH`. /// * Panics if `bits` is not in the range `1..=63`. -/// * Panics if `bytes.len()` is less than `bits * BLOCK_WIDTH`. +/// * Panics if `bytes.len()` is less than `bits`. pub(crate) fn pack_bits_block(values: &[u64], bytes: &mut [u8], bits: u8) { assert_eq!(values.len(), BLOCK_WIDTH, "values length must be 8"); assert!( (1..=63).contains(&bits), "wrong number of bits in pack_bits_block8: {bits}" ); - assert!( - bytes.len() < bits as usize * BLOCK_WIDTH, - "output buffer too small" - ); + assert!(bytes.len() >= bits as usize, "output buffer too small"); match bits { 1 => pack_bits_1(values, bytes), @@ -5060,17 +5057,14 @@ pub(crate) fn pack_bits_block(values: &[u64], bytes: &mut [u8], bits: u8) { /// /// * Panics if `values.len()` is not equal to `BLOCK_WIDTH`. /// * Panics if `bits` is not in the range `1..=63`. -/// * Panics if `bytes.len()` is less than `bits * BLOCK_WIDTH`. +/// * Panics if `bytes.len()` is less than `bits`. pub(crate) fn unpack_bits_block(values: &mut [u64], bytes: &[u8], bits: u8) { assert_eq!(values.len(), BLOCK_WIDTH, "values length must be 8"); assert!( (1..=63).contains(&bits), "wrong number of bits in unpack_bits_block8: {bits}" ); - assert!( - bytes.len() < bits as usize * BLOCK_WIDTH, - "input buffer too small" - ); + assert!(bytes.len() >= bits as usize, "output buffer too small"); match bits { 1 => unpack_bits_1(values, bytes),