-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
In fsst-develop/src/lib.rs, the comment requires symbols.len() <= 256 while code checks symbols.len() < 256.
pub const FSST_CODE_BASE: u16 = 256;
/// # Panics
///
/// If the provided symbol table has length greater than 256
pub fn new(symbols: &'a [Symbol], lengths: &'a [u8]) -> Self {
assert!(
symbols.len() < FSST_CODE_BASE as usize,
"symbol table cannot have size exceeding 255"
);
Self { symbols, lengths }
}This comment seem to require decoded.len() >= compressed.len() + 7, while code check it inconsistently.
/// Decompress a slice of codes into a provided buffer.
///
/// The provided `decoded` buffer must be at least the size of the decoded data, plus
/// an additional 7 bytes.
///
/// ## Panics
///
/// If the caller fails to provide sufficient capacity in the decoded buffer. An upper bound
/// on the required capacity can be obtained by calling [`Self::max_decompression_capacity`].
pub fn decompress_into(&self, compressed: &[u8], decoded: &mut [MaybeUninit<u8>]) -> usize {
// Ensure the target buffer is at least half the size of the input buffer.
// This is the theortical smallest a valid target can be, and occurs when
// every input code is an escape.
assert!(
decoded.len() >= compressed.len() / 2,
"decoded is smaller than lower-bound decompressed size"
);
...
}Metadata
Metadata
Assignees
Labels
No labels