Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libpopcnt to v2.6 #17098

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oss/libpopcnt/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"git": {
"repositoryUrl": "https://github.com/kimwalisch/libpopcnt",
"commitHash": "c49987e90e56191c399cab881ab87b5daecc9b8e"
"commitHash": "2ca88fd36c550326b3ae2471ff05bc43a95379a1"
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions oss/libpopcnt/libpopcnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* population count) in an array as quickly as possible using
* specialized CPU instructions i.e. POPCNT, AVX2, AVX512, NEON.
*
* Copyright (c) 2016 - 2020, Kim Walisch
* Copyright (c) 2016 - 2024, Kim Walisch
* Copyright (c) 2016 - 2018, Wojciech Muła
*
* All rights reserved.
Expand Down Expand Up @@ -149,7 +149,7 @@ extern "C" {
* It uses 12 arithmetic operations, one of which is a multiply.
* http://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation
*/
static inline uint64_t popcount64(uint64_t x)
static inline uint64_t popcnt64_bitwise(uint64_t x)
{
uint64_t m1 = 0x5555555555555555ll;
uint64_t m2 = 0x3333333333333333ll;
Expand Down Expand Up @@ -222,7 +222,7 @@ static inline uint64_t popcnt64(uint64_t x)

static inline uint64_t popcnt64(uint64_t x)
{
return popcount64(x);
return popcnt64_bitwise(x);
}

#endif
Expand Down Expand Up @@ -645,14 +645,14 @@ static inline uint64_t popcnt(const void* data, uint64_t size)
* We use unaligned memory accesses here to improve performance.
*/
for (; i < size - size % 8; i += 8)
cnt += popcount64(*(const uint64_t*)(ptr + i));
cnt += popcnt64_bitwise(*(const uint64_t*)(ptr + i));

if (i < size)
{
uint64_t val = 0;
size_t bytes = (size_t)(size - i);
memcpy(&val, &ptr[i], bytes);
cnt += popcount64(val);
cnt += popcnt64_bitwise(val);
}

return cnt;
Expand Down Expand Up @@ -750,7 +750,7 @@ static inline uint64_t popcnt(const void* data, uint64_t size)
uint64_t val = 0;
size_t bytes = (size_t)(size - i);
memcpy(&val, &ptr[i], bytes);
cnt += popcount64(val);
cnt += popcnt64_bitwise(val);
}

return cnt;
Expand Down
Loading