Hi Kou,

Thanks for your help.

In order to file a bug report, I probably need some Jira account, since it is 
asking me to login.

I might be able to help fixing it, but not right away.  I will continue 
exploring 64 bit for now.

Thanks,
Arkadiy

From: user@arrow.apache.org At: 05/30/22 02:05:07 UTC-4:00To:  Arkadiy Vertleyb 
(BLOOMBERG/ 120 PARK ) ,  user@arrow.apache.org
Subject: Re: Does cpp Win32 work?

Hi,

It seems that 32 bit Windows doesn't provide the followings:

* __popcnt64()
* _BitScanReverse64()
* _BitScanForward64()

We have fallback implementations for _BitScan*64(). So we
can use them by the following change:

----
diff --git a/cpp/src/arrow/util/bit_util.h b/cpp/src/arrow/util/bit_util.h
index 8583e10b22..e06e3399e1 100644
--- a/cpp/src/arrow/util/bit_util.h
+++ b/cpp/src/arrow/util/bit_util.h
@@ -199,7 +199,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);
@@ -220,7 +220,7 @@ static inline int CountTrailingZeros(uint32_t value) {
 #if defined(__clang__) || defined(__GNUC__)
   if (value == 0) return 32;
   return static_cast<int>(__builtin_ctzl(value));
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_X64))
   unsigned long index;  // NOLINT
   if (_BitScanForward(&index, value)) {
     return static_cast<int>(index);
----

But we don't have a fall back implementation for
__popcnt64(). Could you file this to
https://issues.apache.org/jira/browse/ARROW ?

BTW, do you want to work on this?


Thanks,
-- 
kou


In <6290DDC6005E02EC00390001_0_37693@msllnjpmsgsv06>
  "Does cpp Win32 work?" on Fri, 27 May 2022 14:18:46 -0000,
  "Arkadiy Vertleyb (BLOOMBERG/ 120 PARK)" <avertl...@bloomberg.net> wrote:

> Hi all,
> 
> After resolving my linker issue, I now have the following problem:
> 
> 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]
> 
> Looks like it is trying to use 64 bit stuff, which isn't defined in the 32 
bit architecture.
> 
> One thing I noticed - all vcproj files contain:
> 
>   <PropertyGroup>
>     <PreferredToolArchitecture>x64</PreferredToolArchitecture>
>   </PropertyGroup>
> 
> Not sure if this is the issue, but looks suspicious.
> 
> Also, for some reason, generated vcproj files don't contain C++ properties, 
including preprocessor properties, when I open them in MSVC.
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> Arkadiy


Reply via email to