diff options
| author | edwloef <edwin.frank.loeffler@gmail.com> | 2025-01-28 12:26:32 +0100 |
|---|---|---|
| committer | edwloef <edwin.frank.loeffler@gmail.com> | 2025-01-29 19:34:19 +0100 |
| commit | fb3d1d0c4bcd1b744c8ef23ba977bad9fcd43849 (patch) | |
| tree | e462872232d47d6a8b903706c4b9d3d0ca05c9f9 /library/core | |
| parent | 311c3b71f0972e144cac91679a08906875c8af3f (diff) | |
| download | rust-fb3d1d0c4bcd1b744c8ef23ba977bad9fcd43849.tar.gz rust-fb3d1d0c4bcd1b744c8ef23ba977bad9fcd43849.zip | |
add inline attribute and codegen test
Diffstat (limited to 'library/core')
| -rw-r--r-- | library/core/src/slice/rotate.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/library/core/src/slice/rotate.rs b/library/core/src/slice/rotate.rs index 3e88978b781..5d5ee4c7b62 100644 --- a/library/core/src/slice/rotate.rs +++ b/library/core/src/slice/rotate.rs @@ -10,6 +10,7 @@ type BufType = [usize; 32]; /// # Safety /// /// The specified range must be valid for reading and writing. +#[inline] pub(super) unsafe fn ptr_rotate<T>(left: usize, mid: *mut T, right: usize) { if T::IS_ZST { return; @@ -43,6 +44,7 @@ pub(super) unsafe fn ptr_rotate<T>(left: usize, mid: *mut T, right: usize) { /// # Safety /// /// The specified range must be valid for reading and writing. +#[inline] unsafe fn ptr_rotate_memmove<T>(left: usize, mid: *mut T, right: usize) { // The `[T; 0]` here is to ensure this is appropriately aligned for T let mut rawarray = MaybeUninit::<(BufType, [T; 0])>::uninit(); @@ -114,6 +116,7 @@ unsafe fn ptr_rotate_memmove<T>(left: usize, mid: *mut T, right: usize) { /// # Safety /// /// The specified range must be valid for reading and writing. +#[inline] unsafe fn ptr_rotate_gcd<T>(left: usize, mid: *mut T, right: usize) { // Algorithm 2 // Microbenchmarks indicate that the average performance for random shifts is better all @@ -218,6 +221,7 @@ unsafe fn ptr_rotate_gcd<T>(left: usize, mid: *mut T, right: usize) { /// # Safety /// /// The specified range must be valid for reading and writing. +#[inline] unsafe fn ptr_rotate_swap<T>(mut left: usize, mut mid: *mut T, mut right: usize) { loop { if left >= right { |
