diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 1d681c96a75..f546260bc50 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -197,12 +197,21 @@ jobs: strategy: fail-fast: false matrix: - os: - - windows-2019 include: - os: windows-2019 - name: Windows 2019 + name: Windows 2019 x64 generator: Visual Studio 16 2019 + platform: x64 + openssl-n-bits: 64 + program-files-dir: Program Files + chocolate-force: + - os: windows-2019 + name: Windows 2019 Win32 + generator: Visual Studio 16 2019 + platform: Win32 + openssl-n-bits: 32 + program-files-dir: Program Files (x86) + chocolate-force: --forcex86 env: ARROW_BOOST_USE_SHARED: OFF ARROW_BUILD_BENCHMARKS: ON @@ -227,7 +236,7 @@ jobs: ARROW_WITH_ZLIB: ON ARROW_WITH_ZSTD: ON BOOST_SOURCE: BUNDLED - CMAKE_ARGS: '-A x64 -DOPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64' + CMAKE_ARGS: '-A ${{ matrix.platform }} -DOPENSSL_ROOT_DIR=C:/${{ matrix.program-files-dir }}/OpenSSL-Win${{ matrix.openssl-n-bits }}' CMAKE_GENERATOR: ${{ matrix.generator }} CMAKE_INSTALL_LIBDIR: bin CMAKE_INSTALL_PREFIX: /usr @@ -245,7 +254,7 @@ jobs: - name: Installed Packages run: choco list -l - name: Install Dependencies - run: choco install -y --no-progress openssl + run: choco install -y --no-progress ${{ matrix.chocolate-force }} openssl - name: Checkout Arrow uses: actions/checkout@v3 with: diff --git a/cpp/src/arrow/util/bit_util.h b/cpp/src/arrow/util/bit_util.h index 8583e10b226..b5414b34511 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) + return ARROW_POPCOUNT32((bitmap >> 32) & UINT32_MAX) + + ARROW_POPCOUNT32(bitmap & UINT32_MAX); +#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(__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(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(__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(index); @@ -255,7 +262,7 @@ static inline int CountTrailingZeros(uint64_t value) { #else int bitpos = 0; if (value) { - while (value & 1 == 0) { + while ((value & 1) == 0) { value >>= 1; ++bitpos; } diff --git a/cpp/src/arrow/util/io_util.cc b/cpp/src/arrow/util/io_util.cc index 11ae80d03e2..26afc9a23fa 100644 --- a/cpp/src/arrow/util/io_util.cc +++ b/cpp/src/arrow/util/io_util.cc @@ -1439,7 +1439,8 @@ Status MemoryAdviseWillNeed(const std::vector& regions) { PrefetchEntry(const MemoryRegion& region) // NOLINT runtime/explicit : VirtualAddress(region.addr), NumberOfBytes(region.size) {} }; - using PrefetchVirtualMemoryFunc = BOOL (*)(HANDLE, ULONG_PTR, PrefetchEntry*, ULONG); + using PrefetchVirtualMemoryFunc = + BOOL(__stdcall*)(HANDLE, ULONG_PTR, PrefetchEntry*, ULONG); static const auto prefetch_virtual_memory = reinterpret_cast( GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "PrefetchVirtualMemory")); if (prefetch_virtual_memory != nullptr) {