1fanwang commented on code in PR #50998:
URL: https://github.com/apache/arrow/pull/50998#discussion_r4696416909
##########
cpp/src/arrow/util/CMakeLists.txt:
##########
@@ -103,6 +103,7 @@ add_arrow_test(async-utility-test
add_arrow_test(bit-utility-test
SOURCES
bit_block_counter_test.cc
+ bit_util_feature_test.cc
Review Comment:
> Please add the source to the Meson test target as well.
Done in 6b8ea6e549. The source is now part of Meson's arrow-bit-utility-test
target.
##########
cpp/src/arrow/util/bit_util.h:
##########
@@ -142,12 +142,14 @@ static inline uint64_t TrailingBits(uint64_t v, int
num_bits) {
//
// The libc++ in the macOS 11.3 SDK used by CRAN only has the pre-standard
// name std::log2p1. __apple_build_version__ should be defined only on Apple
-// clang.
+// clang. The macOS 12 SDKs have std::bit_width but leave __cpp_lib_bitops
+// undefined, so the check uses __cpp_lib_int_pow2, the feature-test macro for
+// std::bit_width and std::has_single_bit.
// TODO: We can remove this condition once CRAN upgrades its macOS SDK from
11.3.
template <typename T>
constexpr int BitWidth(T x) noexcept {
static_assert(std::is_unsigned_v<T>, "BitWidth requires an unsigned integer
type");
-#if defined(__apple_build_version__) && !defined(__cpp_lib_bitops)
+#if defined(__apple_build_version__) && !defined(__cpp_lib_int_pow2)
Review Comment:
> Please add a compile/routing regression test (or a CI probe) that covers
the macOS 12 and 11.3 macro combinations for both helpers.
Done in 492c867259 and 3fb3b8b4a9. The test simulates the macOS 12 macro
combination and compiles both legacy helper paths when built with the macOS
11.3 SDK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]