Lines Matching +full:compare +full:- +full:and +full:- +full:swap
1 // SPDX-License-Identifier: GPL-2.0
6 * is_aligned - is this pointer & size okay for word-wide copying?
11 * Returns true if elements can be copied using word loads and stores.
12 * The size must be a multiple of the alignment, and the base address must
27 return (lsbits & (align - 1)) == 0; in is_aligned()
31 * swap_words_32 - swap two elements in 32-bit chunks
32 * @a: pointer to the first element to swap
33 * @b: pointer to the second element to swap
47 u32 t = *(u32 *)(a + (n -= 4)); in swap_words_32()
54 * swap_words_64 - swap two elements in 64-bit chunks
55 * @a: pointer to the first element to swap
56 * @b: pointer to the second element to swap
63 * We'd like to use 64-bit loads if possible. If they're not, emulating
65 * processors do not. If CONFIG_64BIT, we definitely have 64-bit loads,
66 * but it's possible to have 64-bit loads without 64-bit pointers (e.g.
73 u64 t = *(u64 *)(a + (n -= 8)); in swap_words_64()
77 /* Use two 32-bit transfers to avoid base+index+4 addressing */ in swap_words_64()
78 u32 t = *(u32 *)(a + (n -= 4)); in swap_words_64()
82 t = *(u32 *)(a + (n -= 4)); in swap_words_64()
90 * swap_bytes - swap two elements a byte at a time
91 * @a: pointer to the first element to swap
92 * @b: pointer to the second element to swap
100 char t = ((char *)a)[--n]; in swap_bytes()
108 * a pointer, but small integers make for the smallest compare
128 ((const struct wrapper *)priv)->swap_func(a, b, (int)size); in do_swap()
147 return ((const struct wrapper *)priv)->cmp(a, b); in do_cmp()
176 /* called from 'sort' without swap function, let's pick the default */ in eytzinger0_sort_r()
177 if (swap_func == SWAP_WRAPPER && !((struct wrapper *)priv)->swap_func) in eytzinger0_sort_r()
190 for (i = n / 2 - 1; i >= 0; --i) { in eytzinger0_sort_r()
191 /* Find the sift-down path all the way to the leaves. */ in eytzinger0_sort_r()
201 j = (j - 1) / 2; in eytzinger0_sort_r()
205 j = (j - 1) / 2; in eytzinger0_sort_r()
211 for (i = n - 1; i > 0; --i) { in eytzinger0_sort_r()
214 /* Find the sift-down path all the way to the leaves. */ in eytzinger0_sort_r()
224 j = (j - 1) / 2; in eytzinger0_sort_r()
228 j = (j - 1) / 2; in eytzinger0_sort_r()
260 return -1;
303 return -1;