|
1 | 1 | //! This module contains the entry points for `slice::sort`. |
2 | 2 |
|
3 | | -#[cfg(not(feature = "optimize_for_size"))] |
| 3 | +#[cfg(not(any(feature = "optimize_for_size", target_pointer_width = "16")))] |
4 | 4 | use crate::cmp; |
5 | 5 | use crate::intrinsics; |
6 | 6 | use crate::mem::{self, MaybeUninit, SizedTypeProperties}; |
7 | | -#[cfg(not(feature = "optimize_for_size"))] |
| 7 | +#[cfg(not(any(feature = "optimize_for_size", target_pointer_width = "16")))] |
8 | 8 | use crate::slice::sort::shared::smallsort::{ |
9 | 9 | SMALL_SORT_GENERAL_SCRATCH_LEN, StableSmallSortTypeImpl, insertion_sort_shift_left, |
10 | 10 | }; |
11 | 11 |
|
12 | 12 | pub(crate) mod merge; |
13 | 13 |
|
14 | | -#[cfg(not(feature = "optimize_for_size"))] |
| 14 | +#[cfg(not(any(feature = "optimize_for_size", target_pointer_width = "16")))] |
15 | 15 | pub(crate) mod drift; |
16 | | -#[cfg(not(feature = "optimize_for_size"))] |
| 16 | +#[cfg(not(any(feature = "optimize_for_size", target_pointer_width = "16")))] |
17 | 17 | pub(crate) mod quicksort; |
18 | 18 |
|
19 | | -#[cfg(feature = "optimize_for_size")] |
| 19 | +#[cfg(any(feature = "optimize_for_size", target_pointer_width = "16"))] |
20 | 20 | pub(crate) mod tiny; |
21 | 21 |
|
22 | 22 | /// Stable sort called driftsort by Orson Peters and Lukas Bergdoll. |
@@ -45,7 +45,7 @@ pub fn sort<T, F: FnMut(&T, &T) -> bool, BufT: BufGuard<T>>(v: &mut [T], is_less |
45 | 45 |
|
46 | 46 | cfg_if! { |
47 | 47 | if #[cfg(target_pointer_width = "16")] { |
48 | | - let heap_buf = BufT::with_capacity(alloc_len); |
| 48 | + let mut heap_buf = BufT::with_capacity(alloc_len); |
49 | 49 | let scratch = heap_buf.as_uninit_slice_mut(); |
50 | 50 | } else { |
51 | 51 | // For small inputs 4KiB of stack storage suffices, which allows us to avoid |
@@ -85,7 +85,7 @@ pub fn sort<T, F: FnMut(&T, &T) -> bool, BufT: BufGuard<T>>(v: &mut [T], is_less |
85 | 85 | /// |
86 | 86 | /// Deliberately don't inline the main sorting routine entrypoint to ensure the |
87 | 87 | /// inlined insertion sort i-cache footprint remains minimal. |
88 | | -#[cfg(not(feature = "optimize_for_size"))] |
| 88 | +#[cfg(not(any(feature = "optimize_for_size", target_pointer_width = "16")))] |
89 | 89 | #[inline(never)] |
90 | 90 | fn driftsort_main<T, F: FnMut(&T, &T) -> bool, BufT: BufGuard<T>>(v: &mut [T], is_less: &mut F) { |
91 | 91 | // By allocating n elements of memory we can ensure the entire input can |
|
0 commit comments