You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Arkadiy Vertleyb (Jira)" <ji...@apache.org> on 2022/06/09 16:52:00 UTC
[jira] [Comment Edited] (ARROW-16778) [C++] 32 bit MSVC doesn't build
[ https://issues.apache.org/jira/browse/ARROW-16778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552314#comment-17552314 ]
Arkadiy Vertleyb edited comment on ARROW-16778 at 6/9/22 4:51 PM:
------------------------------------------------------------------
I was going to, but after I got the build fixed the arrow-utility-test hangs. Not sure if it is related to my fix, haven't figured out yet how debug it properly.
This was my patch:
index 8583e10b2..5122cb3d5 100644
--- a/cpp/src/arrow/util/bit_util.h
+++ b/cpp/src/arrow/util/bit_util.h
@@ -67,7 +67,14 @@ static constexpr uint8_t kBytePopcount[] = {
5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6,
4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
-static inline uint64_t PopCount(uint64_t bitmap) { return ARROW_POPCOUNT64(bitmap); }
+static inline uint64_t PopCount(uint64_t bitmap) {
+#if defined(_MSC_VER) && !defined(_M_AMD64) && !defined(_M_X64)
+ const uint32_t* p = reinterpret_cast<const uint32_t*>(&bitmap);
+ return ARROW_POPCOUNT32(*p) + ARROW_POPCOUNT32(*(p + 1));
+#else
+ return ARROW_POPCOUNT64(bitmap);
+#endif
+}
static inline uint32_t PopCount(uint32_t bitmap) { return ARROW_POPCOUNT32(bitmap); }
//
@@ -199,7 +206,7 @@ static inline int CountLeadingZeros(uint64_t value) {
#if defined(__clang__) || defined(__GNUC__)
if (value == 0) return 64;
return static_cast<int>(__builtin_clzll(value));
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_X64))
unsigned long index; // NOLINT
if (_BitScanReverse64(&index, value)) { // NOLINT
return 63 - static_cast<int>(index);
@@ -245,7 +252,7 @@ static inline int CountTrailingZeros(uint64_t value) {
#if defined(__clang__) || defined(__GNUC__)
if (value == 0) return 64;
return static_cast<int>(__builtin_ctzll(value));
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_X64))
unsigned long index; // NOLINT
if (_BitScanForward64(&index, value)) {
return static_cast<int>(index);
was (Author: JIRAUSER290619):
I was going to, but after I got the build fixed the arrow-utility-test hangs. Not sure if it is related to my fix, haven't figured out yet how debug it properly.
This was my patch:
index 8583e10b2..5122cb3d5 100644
--- a/cpp/src/arrow/util/bit_util.h
+++ b/cpp/src/arrow/util/bit_util.h
@@ -67,7 +67,14 @@ static constexpr uint8_t kBytePopcount[] = {
5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6,
4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
-static inline uint64_t PopCount(uint64_t bitmap) { return ARROW_POPCOUNT64(bitmap); }
+static inline uint64_t PopCount(uint64_t bitmap) {
+#if defined(_MSC_VER) && !defined(_M_AMD64) && !defined(_M_X64)
+ const uint32_t* p = reinterpret_cast<const uint32_t*>(&bitmap);
+ return ARROW_POPCOUNT32(*p) + ARROW_POPCOUNT32(*(p + 1));
+#else
+ return ARROW_POPCOUNT64(bitmap);
+#endif
+}
static inline uint32_t PopCount(uint32_t bitmap) { return ARROW_POPCOUNT32(bitmap); }
//
@@ -199,7 +206,7 @@ static inline int CountLeadingZeros(uint64_t value) {
#if defined(__clang__) || defined(__GNUC__)
if (value == 0) return 64;
return static_cast<int>(__builtin_clzll(value));
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_X64))
unsigned long index; // NOLINT
if (_BitScanReverse64(&index, value)) { // NOLINT
return 63 - static_cast<int>(index);
@@ -245,7 +252,7 @@ static inline int CountTrailingZeros(uint64_t value) {
#if defined(__clang__) || defined(__GNUC__)
if (value == 0) return 64;
return static_cast<int>(__builtin_ctzll(value));
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_X64))
unsigned long index; // NOLINT
if (_BitScanForward64(&index, value)) {
return static_cast<int>(index);
> [C++] 32 bit MSVC doesn't build
> -------------------------------
>
> Key: ARROW-16778
> URL: https://issues.apache.org/jira/browse/ARROW-16778
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Environment: Win32, MSVC
> Reporter: Arkadiy Vertleyb
> Priority: Major
>
> When specifying Win32 as a platform, and building with MSVC, the build fails with the following compile errors :
> {noformat}
> C:\Users\avertleyb\git\arrow\cpp\src\arrow/util/bit_util.h(70,59): error C3861: '__popcnt64': identifier not found [C:\Users\avertleyb\git\arrow\cpp\build32\src\arrow\arrow_shared.vcxproj]
> C:\Users\avertleyb\git\arrow\cpp\src\arrow/util/bit_util.h(204,7): error C3861: '_BitScanReverse64': identifier not found [C:\Users\avertleyb\git\arrow\cpp\build32\src\arrow\arrow_shared.vcxproj]
> C:\Users\avertleyb\git\arrow\cpp\src\arrow/util/bit_util.h(250,7): error C3861: '_BitScanForward64': identifier not found [C:\Users\avertleyb\git\arrow\cpp\build32\src\arrow\arrow_shared.vcxproj]
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)