Skip to content

Commit

Permalink
make get_maximum_output_size const
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Mar 30, 2024
1 parent 06f9c9a commit 8a8e1ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/block/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ fn init_dict<T: HashTable>(dict: &mut T, dict_data: &mut &[u8]) {
/// Returns the maximum output size of the compressed data.
/// Can be used to preallocate capacity on the output vector
#[inline]
pub fn get_maximum_output_size(input_len: usize) -> usize {
16 + 4 + (input_len as f64 * 1.1) as usize
pub const fn get_maximum_output_size(input_len: usize) -> usize {
16 + 4 + (input_len * 110 / 100) as usize
}

/// Compress all bytes of `input` into `output`.
Expand Down

0 comments on commit 8a8e1ad

Please sign in to comment.