From bccb1d070333a2d67eeba548bf8dca1db9b67fa5 Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Thu, 11 Apr 2024 17:18:39 +0200 Subject: [PATCH] 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) --- ypsu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ypsu.cpp b/ypsu.cpp index 8a72d70..d80a207 100644 --- a/ypsu.cpp +++ b/ypsu.cpp @@ -196,17 +196,17 @@ static inline void mormord_sort_impl(uint32_t *a, int n, int j) noexcept { uint32_t pivoti = 0; while(pivoti < n) { 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) { // swap uint32_t tmp = a[pivoti]; a[pivoti] = a[targeti]; a[targeti] = tmp; - // dec index - --radics[radixval]; } else { // progress pivot ++pivoti; + // "undec" index + ++radics[radixval]; } }