From 99214a413cb2846767cbf85d1392e74b4b77cc47 Mon Sep 17 00:00:00 2001 From: Kim Walisch Date: Sun, 17 Mar 2024 09:53:29 +0100 Subject: [PATCH] Rename libpopcount64(x) to popcnt64_bitwise(x) --- libpopcnt.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libpopcnt.h b/libpopcnt.h index 1291d2d..9b953d7 100644 --- a/libpopcnt.h +++ b/libpopcnt.h @@ -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. @@ -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 libpopcount64(uint64_t x) +static inline uint64_t popcnt64_bitwise(uint64_t x) { uint64_t m1 = 0x5555555555555555ll; uint64_t m2 = 0x3333333333333333ll; @@ -222,7 +222,7 @@ static inline uint64_t popcnt64(uint64_t x) static inline uint64_t popcnt64(uint64_t x) { - return libpopcount64(x); + return popcnt64_bitwise(x); } #endif @@ -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 += libpopcount64(*(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 += libpopcount64(val); + cnt += popcnt64_bitwise(val); } return cnt; @@ -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 += libpopcount64(val); + cnt += popcnt64_bitwise(val); } return cnt;