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;