Skip to content

Commit

Permalink
Add #[inline] annotation to the max function. (#34)
Browse files Browse the repository at this point in the history
This function is called from `EcoVec::align` and `EcoVec::offset`
functions. Although they are marked `#[inline]`, and `max` is private,
that is not sufficient to ensure that it is inlined, and as a result,
`EcoVec::new()` and related functions have calls to `max` in them.
  • Loading branch information
Kmeakin authored Sep 21, 2023
1 parent dbfe096 commit 6a413d9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,7 @@ fn out_of_bounds(index: usize, len: usize) -> ! {
}

// Copy of `std::cmp::max::<usize>()` that is callable in `const` contexts
#[inline]
const fn max(x: usize, y: usize) -> usize {
if x > y {
x
Expand Down

0 comments on commit 6a413d9

Please sign in to comment.