You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/14 01:45:43 UTC

[GitHub] [arrow] avertleyb commented on a diff in pull request #13376: ARROW-16778: [C++] Fix build/unit test issues in msvc/win32

avertleyb commented on code in PR #13376:
URL: https://github.com/apache/arrow/pull/13376#discussion_r896300314


##########
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*>((void*)(&bitmap));
+  return ARROW_POPCOUNT32(*p) + ARROW_POPCOUNT32(*(p + 1));

Review Comment:
   If performance is critical, I would assume this version would just add a couple of bit operation.  But if you feel it looks cleaner I can change this.  Please let me know.
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org