From 2c5b0b11775f67dfc6d62e133d6a52b1eae4e832 Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Fri, 12 Sep 2025 01:49:20 +0200 Subject: [PATCH] minor optimization --- thiersort2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thiersort2.h b/thiersort2.h index 6446d9b..04d06ee 100644 --- a/thiersort2.h +++ b/thiersort2.h @@ -73,8 +73,8 @@ static inline void thiersort2(uint32_t *arr, uint32_t *temparr, int n, sch_rand_ /* Move to the buckets - backwards going save a few cache miss */ /* Rem.: This also changes bucket[i] so they will point to bucket beginnings */ #pragma GCC unroll 64 - for(int i = n; i > 0; --i) { - uint32_t num = arr[i - 1]; + for(int i = 0; i < n; ++i) { + uint32_t num = arr[i]; uint32_t witch = witch_bucket(num); int offset = (--bucket[witch]); temparr[offset] = num;