Skip to content

Commit e1144ae

Browse files
Fix clang-tidy warnings now that we support C++17
Changes mostly automatically generated through run-clang-tidy -fix
1 parent acbdc2c commit e1144ae

47 files changed

Lines changed: 696 additions & 696 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/xsimd/arch/common/xsimd_common_arithmetic.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace xsimd
7575
}
7676

7777
// div
78-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
78+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
7979
XSIMD_INLINE batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
8080
{
8181
return detail::apply([](T x, T y) noexcept -> T
@@ -185,7 +185,7 @@ namespace xsimd
185185
struct mulhi_helper
186186
{
187187
using wider = std::conditional_t<
188-
std::is_signed<T>::value,
188+
std::is_signed_v<T>,
189189
std::conditional_t<sizeof(T) == 1, int16_t,
190190
std::conditional_t<sizeof(T) == 2, int32_t, int64_t>>,
191191
std::conditional_t<sizeof(T) == 1, uint16_t,
@@ -368,7 +368,7 @@ namespace xsimd
368368
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
369369
XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
370370
{
371-
if (std::is_signed<T>::value)
371+
if (std::is_signed_v<T>)
372372
{
373373
auto self_pos_branch = min(std::numeric_limits<T>::max() - other, self);
374374
auto self_neg_branch = max(std::numeric_limits<T>::min() - other, self);
@@ -396,7 +396,7 @@ namespace xsimd
396396
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
397397
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
398398
{
399-
if (std::is_signed<T>::value)
399+
if (std::is_signed_v<T>)
400400
{
401401
return sadd(self, -other);
402402
}

include/xsimd/arch/common/xsimd_common_bit.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace xsimd
5151
// FIXME: We could do better by dispatching to the appropriate popcount instruction
5252
// depending on the arch.
5353

54-
template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
54+
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
5555
XSIMD_INLINE int popcount(T x) noexcept
5656
{
5757
#if XSIMD_HAS_BUILTIN(__builtin_popcountg)
@@ -123,7 +123,7 @@ namespace xsimd
123123
#endif
124124
}
125125

126-
template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
126+
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
127127
XSIMD_INLINE int countl_zero(T x) noexcept
128128
{
129129
#if XSIMD_HAS_BUILTIN(__builtin_clzg)
@@ -177,13 +177,13 @@ namespace xsimd
177177
#endif
178178
}
179179

180-
template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
180+
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
181181
XSIMD_INLINE int countl_one(T x) noexcept
182182
{
183183
return countl_zero(T(~x));
184184
}
185185

186-
template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
186+
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
187187
XSIMD_INLINE int countr_zero(T x) noexcept
188188
{
189189
#if XSIMD_HAS_BUILTIN(__builtin_ctzg)
@@ -219,7 +219,7 @@ namespace xsimd
219219
#endif
220220
}
221221

222-
template <class T, class = std::enable_if_t<std::is_unsigned<T>::value>>
222+
template <class T, class = std::enable_if_t<std::is_unsigned_v<T>>>
223223
XSIMD_INLINE int countr_one(T x) noexcept
224224
{
225225
return countr_zero(T(~x));

include/xsimd/arch/common/xsimd_common_details.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace xsimd
9595
template <class T, class A>
9696
XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& self) noexcept;
9797
template <class T, class A, class Vt, Vt... Values>
98-
XSIMD_INLINE std::enable_if_t<std::is_arithmetic<T>::value, batch<T, A>>
98+
XSIMD_INLINE std::enable_if_t<std::is_arithmetic_v<T>, batch<T, A>>
9999
swizzle(batch<T, A> const& x, batch_constant<Vt, A, Values...> mask) noexcept;
100100
template <class T, class A>
101101
XSIMD_INLINE batch<T, A> tan(batch<T, A> const& self) noexcept;

include/xsimd/arch/common/xsimd_common_logical.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace xsimd
110110
}
111111

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

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

156156
// isnan
157-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
157+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
158158
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const&, requires_arch<common>) noexcept
159159
{
160160
return batch_bool<T, A>(false);
161161
}
162162

163163
// le
164-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
164+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
165165
XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
166166
{
167167
return (self < other) || (self == other);

include/xsimd/arch/common/xsimd_common_math.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace xsimd
2929
template <class A, class T, class>
3030
XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<common>) noexcept
3131
{
32-
if (std::is_unsigned<T>::value)
32+
if (std::is_unsigned_v<T>)
3333
return self;
3434
else
3535
{
@@ -85,7 +85,7 @@ namespace xsimd
8585
XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& x, batch<T, A> const& y, std::true_type) noexcept
8686
{
8787
constexpr unsigned shift = 8 * sizeof(T) - 1;
88-
auto adj = std::is_signed<T>::value ? ((x ^ y) & 0x1) : (((x ^ y) << shift) >> shift);
88+
auto adj = std::is_signed_v<T> ? ((x ^ y) & 0x1) : (((x ^ y) << shift) >> shift);
8989
return ::xsimd::kernel::avg(x, y, A {}) + adj;
9090
}
9191

@@ -124,7 +124,7 @@ namespace xsimd
124124
template <class A, class T_out, class T_in>
125125
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
126126
{
127-
static_assert(!std::is_same<T_in, T_out>::value, "there should be no conversion for this type combination");
127+
static_assert(!std::is_same_v<T_in, T_out>, "there should be no conversion for this type combination");
128128
using batch_type_in = batch<T_in, A>;
129129
using batch_type_out = batch<T_out, A>;
130130
static_assert(batch_type_in::size == batch_type_out::size, "compatible sizes");
@@ -148,8 +148,8 @@ namespace xsimd
148148
template <class A, class T>
149149
XSIMD_INLINE batch<T, A> bitofsign(batch<T, A> const& self, requires_arch<common>) noexcept
150150
{
151-
static_assert(std::is_integral<T>::value, "int type implementation");
152-
if (std::is_unsigned<T>::value)
151+
static_assert(std::is_integral_v<T>, "int type implementation");
152+
if (std::is_unsigned_v<T>)
153153
return batch<T, A>(0);
154154
else
155155
return self >> (T)(8 * sizeof(T) - 1);
@@ -286,7 +286,7 @@ namespace xsimd
286286
}
287287

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

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

19101910
// nearbyint
1911-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
1911+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
19121912
XSIMD_INLINE batch<T, A> nearbyint(batch<T, A> const& self, requires_arch<common>) noexcept
19131913
{
19141914
return self;
@@ -1940,7 +1940,7 @@ namespace xsimd
19401940
}
19411941

19421942
// nearbyint_as_int
1943-
template <class T, class A, class = std::enable_if_t<std::is_integral<T>::value>>
1943+
template <class T, class A, class = std::enable_if_t<std::is_integral_v<T>>>
19441944
XSIMD_INLINE batch<T, A> nearbyint_as_int(batch<T, A> const& self, requires_arch<common>) noexcept
19451945
{
19461946
return self;
@@ -1970,7 +1970,7 @@ namespace xsimd
19701970
// nextafter
19711971
namespace detail
19721972
{
1973-
template <class T, class A, bool is_int = std::is_integral<T>::value>
1973+
template <class T, class A, bool is_int = std::is_integral_v<T>>
19741974
struct nextafter_kernel
19751975
{
19761976
using batch_type = batch<T, A>;
@@ -2102,7 +2102,7 @@ namespace xsimd
21022102
}
21032103

21042104
// reciprocal
2105-
template <class T, class A, class = std::enable_if_t<std::is_floating_point<T>::value>>
2105+
template <class T, class A, class = std::enable_if_t<std::is_floating_point_v<T>>>
21062106
XSIMD_INLINE batch<T, A> reciprocal(batch<T, A> const& self,
21072107
requires_arch<common>) noexcept
21082108
{
@@ -2217,7 +2217,7 @@ namespace xsimd
22172217
detail::reassociation_barrier(q, "prevent pulling multiply back through rounded quotient");
22182218
return fnma(q, other, self);
22192219
}
2220-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
2220+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
22212221
XSIMD_INLINE batch<T, A> remainder(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
22222222
{
22232223
auto mod = self % other;
@@ -2232,7 +2232,7 @@ namespace xsimd
22322232
}
22332233

22342234
// sign
2235-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
2235+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
22362236
XSIMD_INLINE batch<T, A> sign(batch<T, A> const& self, requires_arch<common>) noexcept
22372237
{
22382238
using batch_type = batch<T, A>;
@@ -2278,7 +2278,7 @@ namespace xsimd
22782278
}
22792279

22802280
// signnz
2281-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
2281+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
22822282
XSIMD_INLINE batch<T, A> signnz(batch<T, A> const& self, requires_arch<common>) noexcept
22832283
{
22842284
using batch_type = batch<T, A>;
@@ -2315,8 +2315,8 @@ namespace xsimd
23152315
XSIMD_INLINE batch<std::complex<T>, A> sqrt(batch<std::complex<T>, A> const& z, requires_arch<common>) noexcept
23162316
{
23172317

2318-
constexpr T csqrt_scale_factor = std::is_same<T, float>::value ? 6.7108864e7f : 1.8014398509481984e16;
2319-
constexpr T csqrt_scale = std::is_same<T, float>::value ? 1.220703125e-4f : 7.450580596923828125e-9;
2318+
constexpr T csqrt_scale_factor = std::is_same_v<T, float> ? 6.7108864e7f : 1.8014398509481984e16;
2319+
constexpr T csqrt_scale = std::is_same_v<T, float> ? 1.220703125e-4f : 7.450580596923828125e-9;
23202320
using batch_type = batch<std::complex<T>, A>;
23212321
using real_batch = batch<T, A>;
23222322
real_batch x = z.real();

include/xsimd/arch/common/xsimd_common_memory.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ namespace xsimd
312312
template <class A, class T_in, class T_out>
313313
XSIMD_INLINE batch<T_out, A> load_aligned(T_in const* mem, convert<T_out>, requires_arch<common>, with_slow_conversion) noexcept
314314
{
315-
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct load for this type combination");
315+
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct load for this type combination");
316316
using batch_type_out = batch<T_out, A>;
317317
alignas(A::alignment()) T_out buffer[batch_type_out::size];
318318
std::copy(mem, mem + batch_type_out::size, std::begin(buffer));
@@ -339,7 +339,7 @@ namespace xsimd
339339
template <class A, class T_in, class T_out>
340340
XSIMD_INLINE batch<T_out, A> load_unaligned(T_in const* mem, convert<T_out> cvt, requires_arch<common>, with_slow_conversion) noexcept
341341
{
342-
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct load for this type combination");
342+
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct load for this type combination");
343343
return load_aligned<A>(mem, cvt, common {}, with_slow_conversion {});
344344
}
345345
}
@@ -376,9 +376,9 @@ namespace xsimd
376376
// otherwise the scalar-buffer fallback is used. Names no architecture.
377377
template <class A, class T_in, class T_out>
378378
using masked_memory_uses_fp_bitcast = std::integral_constant<bool,
379-
std::is_same<T_in, T_out>::value
380-
&& std::is_integral<T_out>::value
381-
&& !std::is_void<sized_fp_t<sizeof(T_out)>>::value
379+
std::is_same_v<T_in, T_out>
380+
&& std::is_integral_v<T_out>
381+
&& !std::is_void_v<sized_fp_t<sizeof(T_out)>>
382382
&& types::has_simd_register<sized_fp_t<sizeof(T_out)>, A>::value>;
383383

384384
// Scalar-buffer fallback: materialize masked-off lanes as zero, then load.
@@ -728,7 +728,7 @@ namespace xsimd
728728
template <class A, class T_in, class T_out>
729729
XSIMD_INLINE void store_aligned(T_out* mem, batch<T_in, A> const& self, requires_arch<common>) noexcept
730730
{
731-
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct store for this type combination");
731+
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct store for this type combination");
732732
alignas(A::alignment()) T_in buffer[batch<T_in, A>::size];
733733
store_aligned(&buffer[0], self);
734734
std::copy(std::begin(buffer), std::end(buffer), mem);
@@ -738,7 +738,7 @@ namespace xsimd
738738
template <class A, class T_in, class T_out>
739739
XSIMD_INLINE void store_unaligned(T_out* mem, batch<T_in, A> const& self, requires_arch<common>) noexcept
740740
{
741-
static_assert(!std::is_same<T_in, T_out>::value, "there should be a direct store for this type combination");
741+
static_assert(!std::is_same_v<T_in, T_out>, "there should be a direct store for this type combination");
742742
return store_aligned<A>(mem, self, common {});
743743
}
744744

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

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

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

include/xsimd/arch/common/xsimd_common_rounding.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace xsimd
4949
}
5050

5151
// trunc
52-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
52+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
5353
XSIMD_INLINE batch<T, A> trunc(batch<T, A> const& self, requires_arch<common>) noexcept
5454
{
5555
return self;

include/xsimd/arch/common/xsimd_common_swizzle.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ namespace xsimd
184184
template <std::size_t LaneSizeBytes, typename ElemT, typename U, U... Vs>
185185
XSIMD_INLINE constexpr bool is_cross_lane_with_lane_size() noexcept
186186
{
187-
static_assert(std::is_integral<U>::value, "swizzle mask values must be integral");
187+
static_assert(std::is_integral_v<U>, "swizzle mask values must be integral");
188188
static_assert(sizeof...(Vs) >= 1, "need at least one value");
189189
static_assert(LaneSizeBytes > 0, "lane size must be positive");
190190

include/xsimd/arch/common/xsimd_common_trigo.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ namespace xsimd
158158
*/
159159
namespace detail
160160
{
161-
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
161+
template <class A, class T, class = std::enable_if_t<std::is_integral_v<T>>>
162162
XSIMD_INLINE batch<T, A>
163163
average(const batch<T, A>& x1, const batch<T, A>& x2) noexcept
164164
{

0 commit comments

Comments
 (0)