reuse get_calculated_value (#1472)

This commit is contained in:
PSeitz
2022-08-24 01:16:25 -07:00
committed by GitHub
parent 21519788ea
commit 82209c58aa
2 changed files with 2 additions and 7 deletions

View File

@@ -124,7 +124,7 @@ fn diff(val1: u64, val2: u64) -> f64 {
}
#[inline]
fn get_calculated_value(first_val: u64, pos: u64, slope: f32) -> u64 {
pub fn get_calculated_value(first_val: u64, pos: u64, slope: f32) -> u64 {
if slope < 0.0 {
first_val - (pos as f32 * -slope) as u64
} else {

View File

@@ -17,7 +17,7 @@ use common::{BinarySerializable, CountingWriter, DeserializeFrom};
use ownedbytes::OwnedBytes;
use tantivy_bitpacker::{compute_num_bits, BitPacker, BitUnpacker};
use crate::linearinterpol::get_slope;
use crate::linearinterpol::{get_calculated_value, get_slope};
use crate::{FastFieldCodecReader, FastFieldCodecSerializer, FastFieldDataAccess, FastFieldStats};
const CHUNK_SIZE: u64 = 512;
@@ -355,11 +355,6 @@ fn distance<T: Sub<Output = T> + Ord>(x: T, y: T) -> T {
}
}
#[inline]
fn get_calculated_value(first_val: u64, pos: u64, slope: f32) -> u64 {
(first_val as i64 + (pos as f32 * slope) as i64) as u64
}
#[cfg(test)]
mod tests {
use super::*;