Skip to content

Commit c30eafe

Browse files
authored
Fix clang-tidy warnings (#1390)
1 parent 7cf60c8 commit c30eafe

25 files changed

Lines changed: 524 additions & 510 deletions

examples/pico_bench.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ namespace pico_bench
202202
}
203203

204204
template <typename Fn>
205-
std::enable_if_t<std::is_void<decltype(std::declval<Fn>()())>::value, stats_type>
205+
std::enable_if_t<std::is_void_v<decltype(std::declval<Fn>()())>, stats_type>
206206
operator()(Fn fn) const
207207
{
208208
return (*this)(BenchWrapper<Fn> { fn });
209209
}
210210

211211
template <typename Fn>
212-
std::enable_if_t<std::is_same<decltype(std::declval<Fn>()()), T>::value, stats_type>
212+
std::enable_if_t<std::is_same_v<decltype(std::declval<Fn>()()), T>, stats_type>
213213
operator()(Fn fn) const
214214
{
215215
// Do a single un-timed warm up run

include/xsimd/arch/common/xsimd_common_arithmetic.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ namespace xsimd
2929
using namespace types;
3030

3131
// bitwise_lshift
32-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
32+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
3333
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
3434
{
3535
return detail::apply([](T x, T y) noexcept
3636
{ return x << y; },
3737
self, other);
3838
}
39-
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
39+
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
4040
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, requires_arch<common>) noexcept
4141
{
4242
constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
@@ -45,14 +45,14 @@ namespace xsimd
4545
}
4646

4747
// bitwise_rshift
48-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
48+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
4949
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
5050
{
5151
return detail::apply([](T x, T y) noexcept
5252
{ return x >> y; },
5353
self, other);
5454
}
55-
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
55+
template <size_t shift, class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
5656
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, requires_arch<common>) noexcept
5757
{
5858
constexpr auto bits = std::numeric_limits<T>::digits + std::numeric_limits<T>::is_signed;
@@ -170,7 +170,7 @@ namespace xsimd
170170
}
171171

172172
// mul
173-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
173+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
174174
XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
175175
{
176176
return detail::apply([](T x, T y) noexcept -> T
@@ -298,7 +298,7 @@ namespace xsimd
298298
}
299299
}
300300

301-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
301+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
302302
XSIMD_INLINE batch<T, A> mul_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
303303
{
304304
return detail::apply([](T x, T y) noexcept -> T
@@ -307,7 +307,7 @@ namespace xsimd
307307
}
308308

309309
// mul_hilo
310-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
310+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
311311
XSIMD_INLINE std::pair<batch<T, A>, batch<T, A>>
312312
mul_hilo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
313313
{
@@ -365,7 +365,7 @@ namespace xsimd
365365
{
366366
return add(self, other); // no saturated arithmetic on floating point numbers
367367
}
368-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
368+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
369369
XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
370370
{
371371
if (std::is_signed_v<T>)
@@ -393,7 +393,7 @@ namespace xsimd
393393
{
394394
return sub(self, other); // no saturated arithmetic on floating point numbers
395395
}
396-
template <class A, class T, class /*=std::enable_if_t<std::is_integral<T>::value>*/>
396+
template <class A, class T, class /*=std::enable_if_t<std::is_integral_v<T>>*/>
397397
XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<common>) noexcept
398398
{
399399
if (std::is_signed_v<T>)

include/xsimd/arch/common/xsimd_common_logical.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ namespace xsimd
210210
namespace detail
211211
{
212212
template <typename T, typename A>
213-
using is_batch_bool_register_same = std::is_same<typename batch_bool<T, A>::register_type, typename batch<T, A>::register_type>;
213+
constexpr bool is_batch_bool_register_same_v = std::is_same_v<typename batch_bool<T, A>::register_type, typename batch<T, A>::register_type>;
214214
}
215215

216-
template <class A, class T, std::enable_if_t<detail::is_batch_bool_register_same<T, A>::value, int> = 3>
216+
template <class A, class T, std::enable_if_t<detail::is_batch_bool_register_same_v<T, A>, int> = 3>
217217
XSIMD_INLINE batch_bool<T, A> select(batch_bool<T, A> const& cond, batch_bool<T, A> const& true_br, batch_bool<T, A> const& false_br, requires_arch<common>)
218218
{
219219
using register_type = typename batch_bool<T, A>::register_type;
@@ -223,7 +223,7 @@ namespace xsimd
223223
return batch_bool<T, A> { select(cond, true_v, false_v) };
224224
}
225225

226-
template <class A, class T, std::enable_if_t<!detail::is_batch_bool_register_same<T, A>::value, int> = 3>
226+
template <class A, class T, std::enable_if_t<!detail::is_batch_bool_register_same_v<T, A>, int> = 3>
227227
XSIMD_INLINE batch_bool<T, A> select(batch_bool<T, A> const& cond, batch_bool<T, A> const& true_br, batch_bool<T, A> const& false_br, requires_arch<common>)
228228
{
229229
return (true_br & cond) | (bitwise_andnot(false_br, cond));

include/xsimd/arch/common/xsimd_common_math.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ namespace xsimd
21172117
return { reduce_add(self.real()), reduce_add(self.imag()) };
21182118
}
21192119

2120-
template <class A, class T, class /*=std::enable_if_t<std::is_scalar<T>::value>*/>
2120+
template <class A, class T, class /*=std::enable_if_t<std::is_scalar_v<T>>*/>
21212121
XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<common>) noexcept
21222122
{
21232123
alignas(A::alignment()) T buffer[batch<T, A>::size];
@@ -2189,7 +2189,7 @@ namespace xsimd
21892189
return res;
21902190
}
21912191

2192-
template <class A, class T, class /*=std::enable_if_t<std::is_scalar<T>::value>*/>
2192+
template <class A, class T, class /*=std::enable_if_t<std::is_scalar_v<T>>*/>
21932193
XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<common>) noexcept
21942194
{
21952195
alignas(A::alignment()) T buffer[batch<T, A>::size];

include/xsimd/arch/common/xsimd_common_memory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ namespace xsimd
379379
std::is_same_v<T_in, T_out>
380380
&& std::is_integral_v<T_out>
381381
&& !std::is_void_v<sized_fp_t<sizeof(T_out)>>
382-
&& types::has_simd_register<sized_fp_t<sizeof(T_out)>, A>::value>;
382+
&& types::has_simd_register_v<sized_fp_t<sizeof(T_out)>, A>>;
383383

384384
// Scalar-buffer fallback: materialize masked-off lanes as zero, then load.
385385
template <class A, class T_in, class T_out, bool... Values, class alignment>

include/xsimd/arch/xsimd_avx.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,24 +1100,24 @@ namespace xsimd
11001100
// True when batch_bool<T, A> shares the data register (__m256/__m256d) rather
11011101
// than an EVEX k-register; the _mm256_cast*_si256 path below needs the former.
11021102
template <class T, class A>
1103-
using uses_vector_mask = std::is_same<typename batch_bool<T, A>::register_type,
1104-
typename batch<T, A>::register_type>;
1103+
inline constexpr bool uses_vector_mask_v = std::is_same_v<typename batch_bool<T, A>::register_type,
1104+
typename batch<T, A>::register_type>;
11051105

1106-
template <class A, class = std::enable_if_t<uses_vector_mask<float, A>::value>>
1106+
template <class A, class = std::enable_if_t<uses_vector_mask_v<float, A>>>
11071107
XSIMD_INLINE void maskstore(float* mem, batch_bool<float, A> const& mask, batch<float, A> const& src) noexcept
11081108
{
11091109
_mm256_maskstore_ps(mem, _mm256_castps_si256(mask), src);
11101110
}
11111111

1112-
template <class A, class = std::enable_if_t<uses_vector_mask<double, A>::value>>
1112+
template <class A, class = std::enable_if_t<uses_vector_mask_v<double, A>>>
11131113
XSIMD_INLINE void maskstore(double* mem, batch_bool<double, A> const& mask, batch<double, A> const& src) noexcept
11141114
{
11151115
_mm256_maskstore_pd(mem, _mm256_castpd_si256(mask), src);
11161116
}
11171117
}
11181118

11191119
template <class A, class T, bool... Values, class Mode,
1120-
typename = std::enable_if_t<std::is_floating_point_v<T> && detail::uses_vector_mask<T, A>::value>>
1120+
typename = std::enable_if_t<std::is_floating_point_v<T> && detail::uses_vector_mask_v<T, A>>>
11211121
XSIMD_INLINE void store_masked(T* mem, batch<T, A> const& src, batch_bool_constant<T, A, Values...> mask, Mode, requires_arch<avx>) noexcept
11221122
{
11231123
constexpr size_t half_size = batch<T, A>::size / 2;

include/xsimd/arch/xsimd_avx512f.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,6 +2669,9 @@ namespace xsimd
26692669
{
26702670
};
26712671

2672+
template <class T, class A, T... Idx>
2673+
inline constexpr bool is_pair_of_contiguous_indices_v = is_pair_of_contiguous_indices<T, A, Idx...>::value;
2674+
26722675
template <class A, uint16_t I0, uint16_t I1, uint16_t I2, uint16_t I3, uint16_t I4, uint16_t I5, uint16_t I6, uint16_t I7,
26732676
uint16_t I8, uint16_t I9, uint16_t I10, uint16_t I11, uint16_t I12, uint16_t I13, uint16_t I14, uint16_t I15,
26742677
uint16_t I16, uint16_t I17, uint16_t I18, uint16_t I19, uint16_t I20, uint16_t I21, uint16_t I22, uint16_t I23,
@@ -2700,7 +2703,7 @@ namespace xsimd
27002703
template <class A, uint16_t... Idx>
27012704
XSIMD_INLINE batch<uint16_t, A> swizzle(batch<uint16_t, A> const& self, batch_constant<uint16_t, A, Idx...> mask, requires_arch<avx512f>) noexcept
27022705
{
2703-
if constexpr (detail::is_pair_of_contiguous_indices<uint16_t, A, Idx...>::value)
2706+
if constexpr (detail::is_pair_of_contiguous_indices_v<uint16_t, A, Idx...>)
27042707
{
27052708
constexpr typename detail::fold_batch_constant<A, Idx...>::type mask32;
27062709
return _mm512_permutexvar_epi32(static_cast<batch<uint32_t, A>>(mask32), self);

include/xsimd/arch/xsimd_common_fwd.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ namespace xsimd
4242
{
4343
template <typename T, class A>
4444
struct has_simd_register;
45+
46+
template <typename T, class A>
47+
inline constexpr bool has_simd_register_v = has_simd_register<T, A>::value;
4548
}
4649

4750
namespace kernel

include/xsimd/arch/xsimd_emulated.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ namespace xsimd
431431
}
432432

433433
// isnan
434-
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size, class = std::enable_if_t<std::is_floating_point<T>::value>>
434+
template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size, class = std::enable_if_t<std::is_floating_point_v<T>>>
435435
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
436436
{
437437
return detail::emulated_apply([](T v)

0 commit comments

Comments
 (0)