mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-24 04:00:40 +00:00
Removed redundant compressed_block_size function
This commit is contained in:
@@ -7,8 +7,9 @@ pub use self::stream::CompressedIntStream;
|
||||
|
||||
pub const COMPRESSION_BLOCK_SIZE: usize = 128;
|
||||
|
||||
pub(crate) fn compute_block_size(num_bits: u8) -> usize {
|
||||
1 + (num_bits as usize * COMPRESSION_BLOCK_SIZE + 7) / 8
|
||||
/// Returns the size in bytes of a compressed block, given `num_bits`.
|
||||
pub fn compressed_block_size(num_bits: u8) -> usize {
|
||||
1 + (num_bits as usize) * 16
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "simdcompression"))]
|
||||
@@ -37,11 +38,6 @@ mod vint {
|
||||
pub(crate) use self::compression_vint_simd::*;
|
||||
}
|
||||
|
||||
/// Returns the size in bytes of a compressed block, given `num_bits`.
|
||||
pub fn compressed_block_size(num_bits: u8) -> usize {
|
||||
1 + (num_bits as usize) * 16
|
||||
}
|
||||
|
||||
pub trait VIntEncoder {
|
||||
/// Compresses an array of `u32` integers,
|
||||
/// using [delta-encoding](https://en.wikipedia.org/wiki/Delta_encoding)
|
||||
|
||||
@@ -3,7 +3,7 @@ use common::bitpacker::{BitPacker, BitUnpacker};
|
||||
use common::CountingWriter;
|
||||
use std::cmp;
|
||||
use std::io::Write;
|
||||
use super::super::{compute_block_size, COMPRESSION_BLOCK_SIZE};
|
||||
use super::super::{compressed_block_size, COMPRESSION_BLOCK_SIZE};
|
||||
|
||||
const COMPRESSED_BLOCK_MAX_SIZE: usize = COMPRESSION_BLOCK_SIZE * 4 + 1;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::super::{compute_block_size, COMPRESSION_BLOCK_SIZE};
|
||||
use compression::COMPRESSION_BLOCK_SIZE;
|
||||
|
||||
const COMPRESSED_BLOCK_MAX_SIZE: usize = COMPRESSION_BLOCK_SIZE * 4 + 1;
|
||||
|
||||
@@ -51,13 +51,11 @@ impl BlockEncoder {
|
||||
|
||||
pub fn compress_block_sorted(&mut self, vals: &[u32], offset: u32) -> &[u8] {
|
||||
let compressed_size = compress_sorted(vals, &mut self.output, offset);
|
||||
assert_eq!(compressed_size, compute_block_size(self.output[0]));
|
||||
&self.output[..compressed_size]
|
||||
}
|
||||
|
||||
pub fn compress_block_unsorted(&mut self, vals: &[u32]) -> &[u8] {
|
||||
let compressed_size = compress_unsorted(vals, &mut self.output);
|
||||
assert_eq!(compressed_size, compute_block_size(self.output[0]));
|
||||
&self.output[..compressed_size]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use postings::Postings;
|
||||
use docset::{DocSet, SkipResult};
|
||||
use std::cmp;
|
||||
use fst::Streamer;
|
||||
use compression::compute_block_size;
|
||||
use compression::compressed_block_size;
|
||||
use fastfield::DeleteBitSet;
|
||||
use std::cell::UnsafeCell;
|
||||
use directory::{ReadOnlySource, SourceRead};
|
||||
@@ -436,7 +436,7 @@ impl BlockSegmentPostings {
|
||||
match self.freq_reading_option {
|
||||
FreqReadingOption::NoFreq => {}
|
||||
FreqReadingOption::SkipFreq => {
|
||||
let num_bytes_to_skip = compute_block_size(self.remaining_data.as_ref()[0]);
|
||||
let num_bytes_to_skip = compressed_block_size(self.remaining_data.as_ref()[0]);
|
||||
self.remaining_data.advance(num_bytes_to_skip);
|
||||
}
|
||||
FreqReadingOption::ReadFreq => {
|
||||
|
||||
Reference in New Issue
Block a user