Skip to content

Commit

Permalink
Remove size_hint::pow_scalar_base
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe-Cholet committed Aug 24, 2023
1 parent 75ead8e commit 4671345
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/size_hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use std::usize;
use std::cmp;
use std::u32;

/// `SizeHint` is the return type of `Iterator::size_hint()`.
pub type SizeHint = (usize, Option<usize>);
Expand Down Expand Up @@ -75,21 +74,6 @@ pub fn mul_scalar(sh: SizeHint, x: usize) -> SizeHint {
(low, hi)
}

/// Raise `base` correctly by a `SizeHint` exponent.
#[inline]
#[allow(dead_code)]
pub fn pow_scalar_base(base: usize, exp: SizeHint) -> SizeHint {
let exp_low = cmp::min(exp.0, u32::MAX as usize) as u32;
let low = base.saturating_pow(exp_low);

let hi = exp.1.and_then(|exp| {
let exp_hi = cmp::min(exp, u32::MAX as usize) as u32;
base.checked_pow(exp_hi)
});

(low, hi)
}

/// Return the maximum
#[inline]
pub fn max(a: SizeHint, b: SizeHint) -> SizeHint {
Expand Down

0 comments on commit 4671345

Please sign in to comment.