Force inline: small functions and single call-site
This commit is contained in:
parent
d92810646e
commit
e3f07b2e30
@ -697,7 +697,7 @@ pub struct WrappingRange {
|
|||||||
|
|
||||||
impl WrappingRange {
|
impl WrappingRange {
|
||||||
/// Returns `true` if `v` is contained in the range.
|
/// Returns `true` if `v` is contained in the range.
|
||||||
#[inline]
|
#[inline(always)]
|
||||||
pub fn contains(&self, v: u128) -> bool {
|
pub fn contains(&self, v: u128) -> bool {
|
||||||
if self.start <= self.end {
|
if self.start <= self.end {
|
||||||
self.start <= v && v <= self.end
|
self.start <= v && v <= self.end
|
||||||
@ -708,17 +708,19 @@ impl WrappingRange {
|
|||||||
|
|
||||||
/// Returns `true` if zero is contained in the range.
|
/// Returns `true` if zero is contained in the range.
|
||||||
/// Equal to `range.contains(0)` but should be faster.
|
/// Equal to `range.contains(0)` but should be faster.
|
||||||
#[inline]
|
#[inline(always)]
|
||||||
pub fn contains_zero(&self) -> bool {
|
pub fn contains_zero(&self) -> bool {
|
||||||
self.start > self.end || self.start == 0
|
self.start > self.end || self.start == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns new `WrappingRange` with replaced `start`
|
/// Returns new `WrappingRange` with replaced `start`
|
||||||
|
#[inline(always)]
|
||||||
pub fn with_start(&self, start: u128) -> Self {
|
pub fn with_start(&self, start: u128) -> Self {
|
||||||
Self { start, end: self.end }
|
Self { start, end: self.end }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns new `WrappingRange` with replaced `end`
|
/// Returns new `WrappingRange` with replaced `end`
|
||||||
|
#[inline(always)]
|
||||||
pub fn with_end(&self, end: u128) -> Self {
|
pub fn with_end(&self, end: u128) -> Self {
|
||||||
Self { start: self.start, end }
|
Self { start: self.start, end }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user