From ac01d33519a66b885d4514f29e4174ef2d427794 Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Fri, 9 May 2025 02:36:15 +0200 Subject: [PATCH] Revert "schwab: tried to change cache friendlyness for branch prediction - it seems it is very marginally worse and much worse if I move thid after the other branches" This reverts commit fac01a81e35f4670aa6534aad9f1a7f4e5d692dd. --- schwab_sort.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/schwab_sort.h b/schwab_sort.h index 527effe..36bd2d6 100644 --- a/schwab_sort.h +++ b/schwab_sort.h @@ -242,17 +242,21 @@ static inline void schwab_sort( /* But that would complicate codes above this point! */ /* Rem.: Order of operations try to be a cache-friendly as */ /* possible, but had to put loops changes to the end */ - if(needmid) { - schwab_sort(array, plo, pmid - 1, state); - schwab_sort(array, pmid, phi - 1, state); - } if(lolen < hilen) { schwab_sort(array, low, plo - 1, state); + if(needmid) { + schwab_sort(array, plo, pmid - 1, state); + schwab_sort(array, pmid, phi - 1, state); + } low = phi; /* high = high; */ } else { schwab_sort(array, phi, high, state); + if(needmid) { + schwab_sort(array, pmid, phi - 1, state); + schwab_sort(array, plo, pmid - 1, state); + } /* low = low; */ high = plo - 1;