Merge pull request #1140 from patowen/improve-dim-performance-with-inline
Use #[inline] to improve opt-level 1 performance
This commit is contained in:
commit
daa2ea33b2
|
@ -252,14 +252,17 @@ pub trait ToTypenum {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<const T: usize> Dim for Const<T> {
|
unsafe impl<const T: usize> Dim for Const<T> {
|
||||||
|
#[inline]
|
||||||
fn try_to_usize() -> Option<usize> {
|
fn try_to_usize() -> Option<usize> {
|
||||||
Some(T)
|
Some(T)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn value(&self) -> usize {
|
fn value(&self) -> usize {
|
||||||
T
|
T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn from_usize(dim: usize) -> Self {
|
fn from_usize(dim: usize) -> Self {
|
||||||
assert_eq!(dim, T);
|
assert_eq!(dim, T);
|
||||||
Self
|
Self
|
||||||
|
|
Loading…
Reference in New Issue