Merge pull request #1140 from patowen/improve-dim-performance-with-inline

Use #[inline] to improve opt-level 1 performance
This commit is contained in:
Sébastien Crozet 2022-08-12 09:22:36 +02:00 committed by GitHub
commit daa2ea33b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -252,14 +252,17 @@ pub trait ToTypenum {
}
unsafe impl<const T: usize> Dim for Const<T> {
#[inline]
fn try_to_usize() -> Option<usize> {
Some(T)
}
#[inline]
fn value(&self) -> usize {
T
}
#[inline]
fn from_usize(dim: usize) -> Self {
assert_eq!(dim, T);
Self