diff --git a/magyarsort.h b/magyarsort.h index c157093..4937a9d 100644 --- a/magyarsort.h +++ b/magyarsort.h @@ -85,6 +85,7 @@ namespace MagyarSort { }; static inline void countOccurences(uint32_t arr[], size_t size, size_t *radicsOut) noexcept { + #pragma GCC unroll 64 for(size_t i = 0; i < size; ++i) { // Creates no object, struct is empty OccurenceMagic(arr, i, radicsOut); @@ -127,12 +128,13 @@ namespace MagyarSort { /** Recursive Functor: no class should be generated I think (compiler should be smart) */ template struct RadixMagic : public RadixMagic { - inline RadixMagic(size_t *radics, uint32_t *&from, uint32_t *&to, size_t size) noexcept // BEWARE: "*&" needed to swap pointers.. + inline __attribute__((always_inline)) RadixMagic(size_t *radics, uint32_t *&from, uint32_t *&to, size_t size) noexcept // BEWARE: "*&" needed to swap pointers.. : RadixMagic(radics, from, to, size) { // DEBUG //printf("%d before: ", DIGIT); //debugArr(from, size); + #pragma GCC unroll 64 for(size_t i = size; i > 0; --i) { // right-to-left to ensure already sorted digits order we keep for iterations // Get num and its new offset / location auto num = from[i - 1];