diff --git a/include/bmat8_impl.hpp b/include/bmat8_impl.hpp index f17d0263..ea4c0f77 100644 --- a/include/bmat8_impl.hpp +++ b/include/bmat8_impl.hpp @@ -406,7 +406,7 @@ inline size_t BMat8::nr_rows() const { return __builtin_popcountll(simde_mm_movemask_epi8(x != epu8{})); } -static HPCOMBI_CONSTEXPR epu8 rev8{7, 6, 5, 4, 3, 2, 1, 0, +static constexpr epu8 rev8{7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15}; inline BMat8 BMat8::row_permuted(Perm16 p) const { epu8 x = simde_mm_set_epi64x(0, _data); diff --git a/include/epu.hpp b/include/epu.hpp index ca56dad7..00fa8e9b 100644 --- a/include/epu.hpp +++ b/include/epu.hpp @@ -24,29 +24,17 @@ #include #include #include +#include // integer_sequences #ifdef HPCOMBI_HAVE_CONFIG #include "HPCombi-config.h" #endif -#if __cplusplus <= 201103L -#include "fallback/seq.hpp" -#endif - #include "vect_generic.hpp" #include "simde/x86/sse4.1.h" #include "simde/x86/sse4.2.h" -#ifdef HPCOMBI_CONSTEXPR_FUN_ARGS -#define HPCOMBI_CONSTEXPR constexpr -#define HPCOMBI_CONSTEXPR_CONSTRUCTOR constexpr -#else -#pragma message "Using a constexpr broken compiler ! " \ - "Performance may not be optimal" -#define HPCOMBI_CONSTEXPR const -#define HPCOMBI_CONSTEXPR_CONSTRUCTOR -#endif namespace HPCombi { diff --git a/include/fallback/seq.hpp b/include/fallback/seq.hpp deleted file mode 100644 index 58dcf899..00000000 --- a/include/fallback/seq.hpp +++ /dev/null @@ -1,85 +0,0 @@ -//****************************************************************************// -// Copyright (C) 2018 Florent Hivert , // -// // -// Distributed under the terms of the GNU General Public License (GPL) // -// // -// This code is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// General Public License for more details. // -// // -// The full text of the GPL is available at: // -// // -// http://www.gnu.org/licenses/ // -//****************************************************************************// - -#ifndef HPCOMBI_FALLBACK_SEQ_HPP_INCLUDED -#define HPCOMBI_FALLBACK_SEQ_HPP_INCLUDED - -namespace bwcompat_details { - // Copy pasted from sources - - // Stores a tuple of indices. Used by tuple and pair, and by bind() to - // extract the elements in a tuple. - template - struct _Index_tuple - { - typedef _Index_tuple<_Indexes..., sizeof...(_Indexes)> __next; - }; - - // Builds an _Index_tuple<0, 1, 2, ..., _Num-1>. - template - struct _Build_index_tuple - { - typedef typename _Build_index_tuple<_Num - 1>::__type::__next __type; - }; - - template<> - struct _Build_index_tuple<0> - { - typedef _Index_tuple<> __type; - }; - - /// Class template integer_sequence - template - struct integer_sequence - { - typedef _Tp value_type; - static constexpr size_t size() { return sizeof...(_Idx); } - }; - - template::__type> - struct _Make_integer_sequence; - - template - struct _Make_integer_sequence<_Tp, _Num, _Index_tuple<_Idx...>> - { - static_assert( _Num >= 0, - "Cannot make integer sequence of negative length" ); - - typedef integer_sequence<_Tp, static_cast<_Tp>(_Idx)...> __type; - }; -} // namespace bwcompat_details - -namespace std { - /// Alias template make_integer_sequence - template - using make_integer_sequence - = typename bwcompat_details::_Make_integer_sequence<_Tp, _Num>::__type; - - /// Alias template index_sequence - template - using index_sequence = bwcompat_details::integer_sequence; - - /// Alias template make_index_sequence - template - using make_index_sequence = make_integer_sequence; - - /// Alias template index_sequence_for - template - using index_sequence_for = make_index_sequence; - -} // namespace std - -#endif // HPCOMBI_FALLBACK_SEQ_HPP_INCLUDED diff --git a/include/perm16.hpp b/include/perm16.hpp index fa8d245c..8178a157 100644 --- a/include/perm16.hpp +++ b/include/perm16.hpp @@ -46,9 +46,9 @@ struct alignas(16) PTransf16 : public Vect16 { using array = decltype(Epu8)::array; PTransf16() = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR PTransf16(const PTransf16 &v) = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR PTransf16(const vect v) : Vect16(v) {} - HPCOMBI_CONSTEXPR_CONSTRUCTOR PTransf16(const epu8 x) : Vect16(x) {} + constexpr PTransf16(const PTransf16 &v) = default; + constexpr PTransf16(const vect v) : Vect16(v) {} + constexpr PTransf16(const epu8 x) : Vect16(x) {} PTransf16(std::vector dom, std::vector rng, size_t = 0 /* unused */); PTransf16(std::initializer_list il); @@ -65,7 +65,7 @@ struct alignas(16) PTransf16 : public Vect16 { } //! The identity partial transformation. - static HPCOMBI_CONSTEXPR PTransf16 one() { return epu8id; } + static constexpr PTransf16 one() { return epu8id; } //! The product of two partial transformations. PTransf16 operator*(const PTransf16 &p) const { return HPCombi::permuted(v, p.v) | (p.v == Epu8(0xFF)); @@ -120,9 +120,9 @@ struct alignas(16) PTransf16 : public Vect16 { */ struct Transf16 : public PTransf16 { Transf16() = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR Transf16(const Transf16 &v) = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR Transf16(const vect v) : PTransf16(v) {} - HPCOMBI_CONSTEXPR_CONSTRUCTOR Transf16(const epu8 x) : PTransf16(x) {} + constexpr Transf16(const Transf16 &v) = default; + constexpr Transf16(const vect v) : PTransf16(v) {} + constexpr Transf16(const epu8 x) : PTransf16(x) {} Transf16(std::initializer_list il) : PTransf16(il) {} Transf16 &operator=(const Transf16 &) = default; @@ -132,7 +132,7 @@ struct Transf16 : public PTransf16 { } //! The identity transformation. - static HPCOMBI_CONSTEXPR Transf16 one() { return epu8id; } + static constexpr Transf16 one() { return epu8id; } //! The product of two transformations. Transf16 operator*(const Transf16 &p) const { return HPCombi::permuted(v, p.v); @@ -149,9 +149,9 @@ struct Transf16 : public PTransf16 { */ struct PPerm16 : public PTransf16 { PPerm16() = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR PPerm16(const PPerm16 &v) = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR PPerm16(const vect v) : PTransf16(v) {} - HPCOMBI_CONSTEXPR_CONSTRUCTOR PPerm16(const epu8 x) : PTransf16(x) {} + constexpr PPerm16(const PPerm16 &v) = default; + constexpr PPerm16(const vect v) : PTransf16(v) {} + constexpr PPerm16(const epu8 x) : PTransf16(x) {} PPerm16(std::vector dom, std::vector rng, size_t = 0 /* unused */) : PTransf16(dom, rng) {} @@ -164,7 +164,7 @@ struct PPerm16 : public PTransf16 { } //! The identity partial permutations. - static HPCOMBI_CONSTEXPR PPerm16 one() { return epu8id; } + static constexpr PPerm16 one() { return epu8id; } //! The product of two partial perrmutations. PPerm16 operator*(const PPerm16 &p) const { return this->PTransf16::operator*(p); @@ -208,9 +208,9 @@ struct PPerm16 : public PTransf16 { */ struct Perm16 : public Transf16 /* public PPerm : diamond problem */ { Perm16() = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR Perm16(const Perm16 &) = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR Perm16(const vect v) : Transf16(v) {} - HPCOMBI_CONSTEXPR_CONSTRUCTOR Perm16(const epu8 x) : Transf16(x) {} + constexpr Perm16(const Perm16 &) = default; + constexpr Perm16(const vect v) : Transf16(v) {} + constexpr Perm16(const epu8 x) : Transf16(x) {} Perm16 &operator=(const Perm16 &) = default; Perm16(std::initializer_list il) : Transf16(il) {} @@ -221,7 +221,7 @@ struct Perm16 : public Transf16 /* public PPerm : diamond problem */ { // being defined (see https://stackoverflow.com/questions/11928089/) // therefore we chose to have functions. //! The identity partial permutation. - static HPCOMBI_CONSTEXPR Perm16 one() { return epu8id; } + static constexpr Perm16 one() { return epu8id; } //! The product of two permutations Perm16 operator*(const Perm16 &p) const { return HPCombi::permuted(v, p.v); diff --git a/include/perm16_impl.hpp b/include/perm16_impl.hpp index 92ec5bb8..78eaefe9 100644 --- a/include/perm16_impl.hpp +++ b/include/perm16_impl.hpp @@ -114,14 +114,14 @@ inline uint8_t PTransf16::nb_fix_points() const { return __builtin_popcountl(fix_points_bitset()); } -inline static HPCOMBI_CONSTEXPR uint8_t hilo_exchng_fun(uint8_t i) { +inline static constexpr uint8_t hilo_exchng_fun(uint8_t i) { return i < 8 ? i + 8 : i - 8; } -static HPCOMBI_CONSTEXPR epu8 hilo_exchng = Epu8(hilo_exchng_fun); -inline static HPCOMBI_CONSTEXPR uint8_t hilo_mask_fun(uint8_t i) { +static constexpr epu8 hilo_exchng = Epu8(hilo_exchng_fun); +inline static constexpr uint8_t hilo_mask_fun(uint8_t i) { return i < 8 ? 0x0 : 0xFF; } -static HPCOMBI_CONSTEXPR epu8 hilo_mask = Epu8(hilo_mask_fun); +static constexpr epu8 hilo_mask = Epu8(hilo_mask_fun); inline Transf16::Transf16(uint64_t compressed) { epu8 res = simde_mm_set_epi64x(compressed, compressed); diff --git a/include/vect16.hpp b/include/vect16.hpp index 8a5a33ff..cfc54f26 100644 --- a/include/vect16.hpp +++ b/include/vect16.hpp @@ -29,10 +29,10 @@ struct alignas(16) Vect16 { epu8 v; Vect16() = default; - HPCOMBI_CONSTEXPR_CONSTRUCTOR Vect16(epu8 x) : v(x) {} + constexpr Vect16(epu8 x) : v(x) {} Vect16(std::initializer_list il, uint8_t def = 0) : v(Epu8(il, def)) {} - HPCOMBI_CONSTEXPR_CONSTRUCTOR operator epu8() const { return v; } + constexpr operator epu8() const { return v; } Vect16 &operator=(const Vect16 &) = default; Vect16 &operator=(const epu8 &vv) {