[libc-commits] [libc] [libc] rename cpp::count_ones to cpp::popcount to better mirror std:: (PR #84388)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Thu Mar 7 14:49:17 PST 2024
================
@@ -269,14 +269,12 @@ first_trailing_one(T value) {
return value == cpp::numeric_limits<T>::max() ? 0 : countr_zero(value) + 1;
}
-/// Count number of 1's aka population count or hamming weight.
+/// Count number of 1's aka population count or Hamming weight.
///
/// Only unsigned integral types are allowed.
-// TODO: rename as 'popcount' to follow the standard
-// https://en.cppreference.com/w/cpp/numeric/popcount
template <typename T>
[[nodiscard]] LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_unsigned_v<T>, int>
-count_ones(T value) {
+popcount(T value) {
----------------
jhuber6 wrote:
Neat, glad people are on top of things.
https://github.com/llvm/llvm-project/pull/84388
More information about the libc-commits
mailing list