Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
Checks: '-*,modernize-type-traits'
WarningsAsErrors: true
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
8 changes: 4 additions & 4 deletions include/xsimd/arch/common/xsimd_common_arithmetic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace xsimd
}

// div
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return detail::apply([](T x, T y) noexcept -> T
Expand Down Expand Up @@ -185,7 +185,7 @@ namespace xsimd
struct mulhi_helper
{
using wider = std::conditional_t<
std::is_signed<T>::value,
std::is_signed_v<T>,
std::conditional_t<sizeof(T) == 1, int16_t,
std::conditional_t<sizeof(T) == 2, int32_t, int64_t>>,
std::conditional_t<sizeof(T) == 1, uint16_t,
Expand Down Expand Up @@ -368,7 +368,7 @@ namespace xsimd
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
if (std::is_signed<T>::value)
if (std::is_signed_v<T>)
{
auto self_pos_branch = min(std::numeric_limits<T>::max() - other, self);
auto self_neg_branch = max(std::numeric_limits<T>::min() - other, self);
Expand Down Expand Up @@ -396,7 +396,7 @@ namespace xsimd
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
if (std::is_signed<T>::value)
if (std::is_signed_v<T>)
{
return sadd(self, -other);
}
Expand Down
10 changes: 5 additions & 5 deletions include/xsimd/arch/common/xsimd_common_bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace xsimd
// FIXME: We could do better by dispatching to the appropriate popcount instruction
// depending on the arch.

template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
XSIMD_INLINE int popcount(T x) noexcept
{
#if XSIMD_HAS_BUILTIN(__builtin_popcountg)
Expand Down Expand Up @@ -123,7 +123,7 @@ namespace xsimd
#endif
}

template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
XSIMD_INLINE int countl_zero(T x) noexcept
{
#if XSIMD_HAS_BUILTIN(__builtin_clzg)
Expand Down Expand Up @@ -177,13 +177,13 @@ namespace xsimd
#endif
}

template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
XSIMD_INLINE int countl_one(T x) noexcept
{
return countl_zero(T(~x));
}

template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
XSIMD_INLINE int countr_zero(T x) noexcept
{
#if XSIMD_HAS_BUILTIN(__builtin_ctzg)
Expand Down Expand Up @@ -219,7 +219,7 @@ namespace xsimd
#endif
}

template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
XSIMD_INLINE int countr_one(T x) noexcept
{
return countr_zero(T(~x));
Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace xsimd
template <class T, class A>
XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& self) noexcept;
template <class T, class A, class Vt, Vt... Values>
XSIMD_INLINE std::enable_if_t<std::is_arithmetic<T>::value, batch<T, A>>
XSIMD_INLINE std::enable_if_t<std::is_arithmetic_v<T>, batch<T, A>>
swizzle(batch<T, A> const& x, batch_constant<Vt, A, Values...> mask) noexcept;
template <class T, class A>
XSIMD_INLINE batch<T, A> tan(batch<T, A> const& self) noexcept;
Expand Down
8 changes: 4 additions & 4 deletions include/xsimd/arch/common/xsimd_common_logical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace xsimd
}

// isinf
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch_bool<T, A> isinf(batch<T, A> const&, requires_arch<common>) noexcept
{
return batch_bool<T, A>(false);
Expand All @@ -137,7 +137,7 @@ namespace xsimd
}

// isfinite
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch_bool<T, A> isfinite(batch<T, A> const&, requires_arch<common>) noexcept
{
return batch_bool<T, A>(true);
Expand All @@ -154,14 +154,14 @@ namespace xsimd
}

// isnan
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const&, requires_arch<common>) noexcept
{
return batch_bool<T, A>(false);
}

// le
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return (self < other) || (self == other);
Expand Down
32 changes: 16 additions & 16 deletions include/xsimd/arch/common/xsimd_common_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace xsimd
template <class A, class T, class>
XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<common>) noexcept
{
if (std::is_unsigned<T>::value)
if (std::is_unsigned_v<T>)
return self;
else
{
Expand Down Expand Up @@ -85,7 +85,7 @@ namespace xsimd
XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& x, batch<T, A> const& y, std::true_type) noexcept
{
constexpr unsigned shift = 8 * sizeof(T) - 1;
auto adj = std::is_signed<T>::value ? ((x ^ y) & 0x1) : (((x ^ y) << shift) >> shift);
auto adj = std::is_signed_v<T> ? ((x ^ y) & 0x1) : (((x ^ y) << shift) >> shift);
return ::xsimd::kernel::avg(x, y, A {}) + adj;
}

Expand Down Expand Up @@ -124,7 +124,7 @@ namespace xsimd
template <class A, class T_out, class T_in>
XSIMD_INLINE batch<T_out, A> batch_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<common>, with_slow_conversion) noexcept
{
static_assert(!std::is_same<T_in, T_out>::value, "there should be no conversion for this type combination");
static_assert(!std::is_same_v<T_in, T_out>, "there should be no conversion for this type combination");
using batch_type_in = batch<T_in, A>;
using batch_type_out = batch<T_out, A>;
static_assert(batch_type_in::size == batch_type_out::size, "compatible sizes");
Expand All @@ -148,8 +148,8 @@ namespace xsimd
template <class A, class T>
XSIMD_INLINE batch<T, A> bitofsign(batch<T, A> const& self, requires_arch<common>) noexcept
{
static_assert(std::is_integral<T>::value, "int type implementation");
if (std::is_unsigned<T>::value)
static_assert(std::is_integral_v<T>, "int type implementation");
if (std::is_unsigned_v<T>)
return batch<T, A>(0);
else
return self >> (T)(8 * sizeof(T) - 1);
Expand Down Expand Up @@ -286,7 +286,7 @@ namespace xsimd
}

// copysign
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_floating_point_v<T>>>
XSIMD_INLINE batch<T, A> copysign(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return abs(self) | bitofsign(other);
Expand Down Expand Up @@ -1899,7 +1899,7 @@ namespace xsimd
}

// mod
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> mod(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
return detail::apply([](T x, T y) noexcept -> T
Expand All @@ -1908,7 +1908,7 @@ namespace xsimd
}

// nearbyint
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> nearbyint(batch<T, A> const& self, requires_arch<common>) noexcept
{
return self;
Expand Down Expand Up @@ -1940,7 +1940,7 @@ namespace xsimd
}

// nearbyint_as_int
template <class T, class A, class = std::enable_if_t<std::is_integral<T>::value>>
template <class T, class A, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> nearbyint_as_int(batch<T, A> const& self, requires_arch<common>) noexcept
{
return self;
Expand Down Expand Up @@ -1970,7 +1970,7 @@ namespace xsimd
// nextafter
namespace detail
{
template <class T, class A, bool is_int = std::is_integral<T>::value>
template <class T, class A, bool is_int = std::is_integral_v<T>>
struct nextafter_kernel
{
using batch_type = batch<T, A>;
Expand Down Expand Up @@ -2102,7 +2102,7 @@ namespace xsimd
}

// reciprocal
template <class T, class A, class = std::enable_if_t<std::is_floating_point<T>::value>>
template <class T, class A, class = std::enable_if_t<std::is_floating_point_v<T>>>
XSIMD_INLINE batch<T, A> reciprocal(batch<T, A> const& self,
requires_arch<common>) noexcept
{
Expand Down Expand Up @@ -2217,7 +2217,7 @@ namespace xsimd
detail::reassociation_barrier(q, "prevent pulling multiply back through rounded quotient");
return fnma(q, other, self);
}
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> remainder(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
{
auto mod = self % other;
Expand All @@ -2232,7 +2232,7 @@ namespace xsimd
}

// sign
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> sign(batch<T, A> const& self, requires_arch<common>) noexcept
{
using batch_type = batch<T, A>;
Expand Down Expand Up @@ -2278,7 +2278,7 @@ namespace xsimd
}

// signnz
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> signnz(batch<T, A> const& self, requires_arch<common>) noexcept
{
using batch_type = batch<T, A>;
Expand Down Expand Up @@ -2315,8 +2315,8 @@ namespace xsimd
XSIMD_INLINE batch<std::complex<T>, A> sqrt(batch<std::complex<T>, A> const& z, requires_arch<common>) noexcept
{

constexpr T csqrt_scale_factor = std::is_same<T, float>::value ? 6.7108864e7f : 1.8014398509481984e16;
constexpr T csqrt_scale = std::is_same<T, float>::value ? 1.220703125e-4f : 7.450580596923828125e-9;
constexpr T csqrt_scale_factor = std::is_same_v<T, float> ? 6.7108864e7f : 1.8014398509481984e16;
constexpr T csqrt_scale = std::is_same_v<T, float> ? 1.220703125e-4f : 7.450580596923828125e-9;
using batch_type = batch<std::complex<T>, A>;
using real_batch = batch<T, A>;
real_batch x = z.real();
Expand Down
20 changes: 10 additions & 10 deletions include/xsimd/arch/common/xsimd_common_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ namespace xsimd
template <class A, class T_in, class T_out>
XSIMD_INLINE batch<T_out, A> load_aligned(T_in const* mem, convert<T_out>, requires_arch<common>, with_slow_conversion) noexcept
{
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct load for this type combination");
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct load for this type combination");
using batch_type_out = batch<T_out, A>;
alignas(A::alignment()) T_out buffer[batch_type_out::size];
std::copy(mem, mem + batch_type_out::size, std::begin(buffer));
Expand All @@ -339,7 +339,7 @@ namespace xsimd
template <class A, class T_in, class T_out>
XSIMD_INLINE batch<T_out, A> load_unaligned(T_in const* mem, convert<T_out> cvt, requires_arch<common>, with_slow_conversion) noexcept
{
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct load for this type combination");
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct load for this type combination");
return load_aligned<A>(mem, cvt, common {}, with_slow_conversion {});
}
}
Expand Down Expand Up @@ -376,9 +376,9 @@ namespace xsimd
// otherwise the scalar-buffer fallback is used. Names no architecture.
template <class A, class T_in, class T_out>
using masked_memory_uses_fp_bitcast = std::integral_constant<bool,
std::is_same<T_in, T_out>::value
&& std::is_integral<T_out>::value
&& !std::is_void<sized_fp_t<sizeof(T_out)>>::value
std::is_same_v<T_in, T_out>
&& std::is_integral_v<T_out>
&& !std::is_void_v<sized_fp_t<sizeof(T_out)>>
&& types::has_simd_register<sized_fp_t<sizeof(T_out)>, A>::value>;

// Scalar-buffer fallback: materialize masked-off lanes as zero, then load.
Expand Down Expand Up @@ -728,7 +728,7 @@ namespace xsimd
template <class A, class T_in, class T_out>
XSIMD_INLINE void store_aligned(T_out* mem, batch<T_in, A> const& self, requires_arch<common>) noexcept
{
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct store for this type combination");
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct store for this type combination");
alignas(A::alignment()) T_in buffer[batch<T_in, A>::size];
store_aligned(&buffer[0], self);
std::copy(std::begin(buffer), std::end(buffer), mem);
Expand All @@ -738,7 +738,7 @@ namespace xsimd
template <class A, class T_in, class T_out>
XSIMD_INLINE void store_unaligned(T_out* mem, batch<T_in, A> const& self, requires_arch<common>) noexcept
{
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct store for this type combination");
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct store for this type combination");
return store_aligned<A>(mem, self, common {});
}

Expand Down Expand Up @@ -792,19 +792,19 @@ namespace xsimd
template <class A, class T>
XSIMD_INLINE batch<std::complex<T>, A> load_complex(batch<T, A> const& /*hi*/, batch<T, A> const& /*lo*/, requires_arch<common>) noexcept
{
static_assert(std::is_same<T, void>::value, "load_complex not implemented for the required architecture");
static_assert(std::is_same_v<T, void>, "load_complex not implemented for the required architecture");
}

template <class A, class T>
XSIMD_INLINE batch<T, A> complex_high(batch<std::complex<T>, A> const& /*src*/, requires_arch<common>) noexcept
{
static_assert(std::is_same<T, void>::value, "complex_high not implemented for the required architecture");
static_assert(std::is_same_v<T, void>, "complex_high not implemented for the required architecture");
}

template <class A, class T>
XSIMD_INLINE batch<T, A> complex_low(batch<std::complex<T>, A> const& /*src*/, requires_arch<common>) noexcept
{
static_assert(std::is_same<T, void>::value, "complex_low not implemented for the required architecture");
static_assert(std::is_same_v<T, void>, "complex_low not implemented for the required architecture");
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_rounding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace xsimd
}

// trunc
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A> trunc(batch<T, A> const& self, requires_arch<common>) noexcept
{
return self;
Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_swizzle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ namespace xsimd
template <std::size_t LaneSizeBytes, typename ElemT, typename U, U... Vs>
XSIMD_INLINE constexpr bool is_cross_lane_with_lane_size() noexcept
{
static_assert(std::is_integral<U>::value, "swizzle mask values must be integral");
static_assert(std::is_integral_v<U>, "swizzle mask values must be integral");
static_assert(sizeof...(Vs) >= 1, "need at least one value");
static_assert(LaneSizeBytes > 0, "lane size must be positive");

Expand Down
2 changes: 1 addition & 1 deletion include/xsimd/arch/common/xsimd_common_trigo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace xsimd
*/
namespace detail
{
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
XSIMD_INLINE batch<T, A>
average(const batch<T, A>& x1, const batch<T, A>& x2) noexcept
{
Expand Down
Loading
Loading