trying with the restrict keyword - unsuccessful

This commit is contained in:
Richard Thier 2022-09-01 02:14:30 +02:00
parent 5831527f9d
commit 1908687002

View File

@ -241,7 +241,7 @@ namespace MagyarSort {
};
template<typename COUNTER_TYP>
static inline void calcPrefixSums(COUNTER_TYP *radics) noexcept {
static inline void calcPrefixSums(COUNTER_TYP *__restrict radics) noexcept {
static thread_local COUNTER_TYP prev[DIGITS];
memset(prev, 0, sizeof(prev));
@ -267,7 +267,7 @@ namespace MagyarSort {
/** Recursive Functor: no class should be generated I think (compiler should be smart) */
template<int DIGIT, typename COUNTER_TYP>
struct RadixMagic : public RadixMagic<DIGIT - 1, COUNTER_TYP> {
inline __attribute__((always_inline)) RadixMagic(bool &swapped, COUNTER_TYP *radics, uint32_t *from, uint32_t *to, COUNTER_TYP size) noexcept
inline __attribute__((always_inline)) RadixMagic(bool &swapped, COUNTER_TYP *__restrict radics, uint32_t *__restrict from, uint32_t *__restrict to, COUNTER_TYP size) noexcept
: RadixMagic<DIGIT - 1, COUNTER_TYP>(swapped, radics, from, to, size) {
// Tricky: see (**)
if(swapped) { // never true for DIGIT 0, see (***)
@ -305,7 +305,7 @@ namespace MagyarSort {
/** Ends template recursion */
template<typename COUNTER_TYP>
struct RadixMagic<-1, COUNTER_TYP> {
inline RadixMagic(bool swapped, COUNTER_TYP *radics, uint32_t *&from, uint32_t *&to, COUNTER_TYP size) noexcept {}
inline RadixMagic(bool swapped, COUNTER_TYP *__restrict radics, uint32_t *__restrict from, uint32_t *__restrict to, COUNTER_TYP size) noexcept {}
};
/* SORT */