Skip to content

Commit d2743d4

Browse files
committed
Use std::is_base_of for arch detection
1 parent f393dfb commit d2743d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cpp/src/arrow/util/bpacking_simd_impl_internal.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ constexpr SwizzleBiLaneGenericPlan<T, N> BuildSwizzleBiLaneGenericPlan(
342342
template <typename Arch, uint8_t... kIdx>
343343
auto swizzle_bytes(const xsimd::batch<uint8_t, Arch>& batch,
344344
xsimd::batch_constant<uint8_t, Arch, kIdx...> mask) {
345-
if constexpr (xsimd::supported_architectures::contains<xsimd::avx2>()) {
345+
if constexpr (std::is_base_of_v<xsimd::avx2, Arch>) {
346346
static constexpr auto kPlan = BuildSwizzleBiLaneGenericPlan(std::array{kIdx...});
347347
static constexpr auto kSelfSwizzleArr = kPlan.self_lane;
348348
constexpr auto kSelfSwizzle = make_batch_constant<kSelfSwizzleArr, Arch>();
@@ -369,8 +369,8 @@ auto swizzle_bytes(const xsimd::batch<uint8_t, Arch>& batch,
369369
template <typename Arch, typename Int, Int... kShifts>
370370
auto left_shift_no_overflow(const xsimd::batch<Int, Arch>& batch,
371371
xsimd::batch_constant<Int, Arch, kShifts...> shifts) {
372-
constexpr bool kHasSse2 = xsimd::supported_architectures::contains<xsimd::sse2>();
373-
constexpr bool kHasAvx2 = xsimd::supported_architectures::contains<xsimd::avx2>();
372+
constexpr bool kHasSse2 = std::is_base_of_v<xsimd::sse2, Arch>;
373+
constexpr bool kHasAvx2 = std::is_base_of_v<xsimd::avx2, Arch>;
374374

375375
if constexpr (kHasSse2 && !kHasAvx2) {
376376
static constexpr auto kShiftsArr = std::array{kShifts...};
@@ -401,8 +401,8 @@ auto left_shift_no_overflow(const xsimd::batch<Int, Arch>& batch,
401401
template <typename Arch, typename Int, Int... kShifts>
402402
auto right_shift_by_excess(const xsimd::batch<Int, Arch>& batch,
403403
xsimd::batch_constant<Int, Arch, kShifts...> shifts) {
404-
constexpr bool kHasSse2 = xsimd::supported_architectures::contains<xsimd::sse2>();
405-
constexpr bool kHasAvx2 = xsimd::supported_architectures::contains<xsimd::avx2>();
404+
constexpr bool kHasSse2 = std::is_base_of_v<xsimd::sse2, Arch>;
405+
constexpr bool kHasAvx2 = std::is_base_of_v<xsimd::avx2, Arch>;
406406

407407
if constexpr (kHasSse2 && !kHasAvx2) {
408408
static constexpr auto kShiftsArr = std::array{kShifts...};

0 commit comments

Comments
 (0)