mormord sort further optimizations (for me slower - btw it might need to be called mormord-prenex-magyarsort at this point? I added a lot to it tbh like copied parts of thiersort for this to work)
This commit is contained in:
parent
02bad1f59f
commit
bccb1d0703
6
ypsu.cpp
6
ypsu.cpp
@ -196,17 +196,17 @@ static inline void mormord_sort_impl(uint32_t *a, int n, int j) noexcept {
|
|||||||
uint32_t pivoti = 0;
|
uint32_t pivoti = 0;
|
||||||
while(pivoti < n) {
|
while(pivoti < n) {
|
||||||
uint32_t radixval = morgrab(a[pivoti], j);
|
uint32_t radixval = morgrab(a[pivoti], j);
|
||||||
uint32_t targeti = radics[radixval] - 1;
|
uint32_t targeti = --radics[radixval]; // already dec index for swap
|
||||||
if(targeti > pivoti) {
|
if(targeti > pivoti) {
|
||||||
// swap
|
// swap
|
||||||
uint32_t tmp = a[pivoti];
|
uint32_t tmp = a[pivoti];
|
||||||
a[pivoti] = a[targeti];
|
a[pivoti] = a[targeti];
|
||||||
a[targeti] = tmp;
|
a[targeti] = tmp;
|
||||||
// dec index
|
|
||||||
--radics[radixval];
|
|
||||||
} else {
|
} else {
|
||||||
// progress pivot
|
// progress pivot
|
||||||
++pivoti;
|
++pivoti;
|
||||||
|
// "undec" index
|
||||||
|
++radics[radixval];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user