added if constexpr(..) where it could be

This commit is contained in:
Richard Thier 2021-12-20 13:29:47 +01:00
parent d858f39708
commit ff05bc2688

View File

@ -317,11 +317,11 @@ namespace MagyarSort {
#endif // !NO_MLOCK #endif // !NO_MLOCK
// "Garbage-collection" // "Garbage-collection"
if(GC) { if constexpr (GC) {
arc = std::vector<uint32_t>(); arc = std::vector<uint32_t>();
// This must be implemented, because we can only access // This must be implemented, because we can only access
// the static in our function body so this is the "way". // the static in our function body so this is the "way".
if(GC_WITHOUT_SORT) { if constexpr (GC_WITHOUT_SORT) {
return; return;
} }
} }
@ -358,7 +358,7 @@ namespace MagyarSort {
// But instead of the below, we do a trickery... // But instead of the below, we do a trickery...
// //
// Rem.: The branch is optimized out in compile time! // Rem.: The branch is optimized out in compile time!
if(REUSE) { if constexpr (REUSE) {
arc.resize(size); arc.resize(size);
} else { } else {
// Must not be .clean() !!! // Must not be .clean() !!!
@ -399,7 +399,7 @@ namespace MagyarSort {
*/ */
template<bool FORCE = false, typename COUNTER_TYP = size_t> template<bool FORCE = false, typename COUNTER_TYP = size_t>
inline void gc() noexcept { inline void gc() noexcept {
if(FORCE) { if constexpr (FORCE) {
// Only GC-ing // Only GC-ing
MagyarSort::sort_impl<COUNTER_TYP, true, true, true>(nullptr, 0); MagyarSort::sort_impl<COUNTER_TYP, true, true, true>(nullptr, 0);
} else { } else {