Skip to content

Commit 1b4b94a

Browse files
edwloefgitbot
authored and
gitbot
committed
add inline attribute and codegen test
1 parent d604d6a commit 1b4b94a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/slice/rotate.rs

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type BufType = [usize; 32];
1010
/// # Safety
1111
///
1212
/// The specified range must be valid for reading and writing.
13+
#[inline]
1314
pub(super) unsafe fn ptr_rotate<T>(left: usize, mid: *mut T, right: usize) {
1415
if T::IS_ZST {
1516
return;
@@ -43,6 +44,7 @@ pub(super) unsafe fn ptr_rotate<T>(left: usize, mid: *mut T, right: usize) {
4344
/// # Safety
4445
///
4546
/// The specified range must be valid for reading and writing.
47+
#[inline]
4648
unsafe fn ptr_rotate_memmove<T>(left: usize, mid: *mut T, right: usize) {
4749
// The `[T; 0]` here is to ensure this is appropriately aligned for T
4850
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) {
114116
/// # Safety
115117
///
116118
/// The specified range must be valid for reading and writing.
119+
#[inline]
117120
unsafe fn ptr_rotate_gcd<T>(left: usize, mid: *mut T, right: usize) {
118121
// Algorithm 2
119122
// 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) {
218221
/// # Safety
219222
///
220223
/// The specified range must be valid for reading and writing.
224+
#[inline]
221225
unsafe fn ptr_rotate_swap<T>(mut left: usize, mut mid: *mut T, mut right: usize) {
222226
loop {
223227
if left >= right {

0 commit comments

Comments
 (0)