Skip to content

Commit

Permalink
Fix some more inlining.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jan 11, 2025
1 parent 6e3bf04 commit b1ede49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lexical-parse-float/src/lemire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub fn lemire<F: LemireFloat>(num: &Number, lossy: bool) -> ExtendedFloat80 {
/// at a Gigabyte per Second" in section 5, "Fast Algorithm", and
/// section 6, "Exact Numbers And Ties", available online:
/// <https://arxiv.org/abs/2101.11408.pdf>.
#[inline]
#[must_use]
#[allow(clippy::missing_inline_in_public_items)] // reason="public for testing only"
pub fn compute_float<F: LemireFloat>(q: i64, mut w: u64, lossy: bool) -> ExtendedFloat80 {
Expand Down Expand Up @@ -201,6 +202,7 @@ const fn full_multiplication(a: u64, b: u64) -> (u64, u64) {
// 64-bit words approximating the result, with the "high" part corresponding to
// the most significant bits and the low part corresponding to the least
// significant bits.
#[inline]
fn compute_product_approx(q: i64, w: u64, precision: usize) -> (u64, u64) {
debug_assert!(q >= SMALLEST_POWER_OF_FIVE as i64, "must be within our required pow5 range");
debug_assert!(q <= LARGEST_POWER_OF_FIVE as i64, "must be within our required pow5 range");
Expand Down
5 changes: 5 additions & 0 deletions lexical-parse-float/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ macro_rules! to_native {
}

/// Parse a float from bytes using a complete parser.
#[inline(always)]
#[allow(clippy::missing_inline_in_public_items)] // reason = "only public for testing"
pub fn parse_complete<F: LemireFloat, const FORMAT: u128>(
bytes: &[u8],
Expand Down Expand Up @@ -280,6 +281,7 @@ pub fn parse_complete<F: LemireFloat, const FORMAT: u128>(
}

/// Parse a float using only the fast path as a complete parser.
#[inline(always)]
#[allow(clippy::missing_inline_in_public_items)] // reason = "only public for testing"
pub fn fast_path_complete<F: LemireFloat, const FORMAT: u128>(
bytes: &[u8],
Expand All @@ -304,6 +306,7 @@ pub fn fast_path_complete<F: LemireFloat, const FORMAT: u128>(
}

/// Parse a float from bytes using a partial parser.
#[inline(always)]
#[allow(clippy::missing_inline_in_public_items)] // reason = "only public for testing"
pub fn parse_partial<F: LemireFloat, const FORMAT: u128>(
bytes: &[u8],
Expand Down Expand Up @@ -352,6 +355,7 @@ pub fn parse_partial<F: LemireFloat, const FORMAT: u128>(
}

/// Parse a float using only the fast path as a partial parser.
#[inline(always)]
#[allow(clippy::missing_inline_in_public_items)] // reason = "only public for testing"
pub fn fast_path_partial<F: LemireFloat, const FORMAT: u128>(
bytes: &[u8],
Expand Down Expand Up @@ -825,6 +829,7 @@ pub fn parse_number<'a, const FORMAT: u128, const IS_PARTIAL: bool>(
))
}

#[inline(always)]
pub fn parse_partial_number<'a, const FORMAT: u128>(
byte: Bytes<'a, FORMAT>,
is_negative: bool,
Expand Down

0 comments on commit b1ede49

Please sign in to comment.