Now, creating a testdir for module 'hamt' works, but produces this
notice:
Notice from module count-one-bits:
This module is deprecated; use the 'stdc_count_ones' module instead.
Fixed as follows.
2026-03-15 Bruno Haible <[email protected]>
hamt: Don't use deprecated module.
* lib/hamt.c: Include <stdbit.h> instead of count-one-bits.h.
(trienode_count, subtrie_lookup, subtrie_insert, subtrie_remove): Call
stdc_count_ones instead of count_one_bits.
* modules/hamt (Depends-on): Add stdc_count_ones. Remove count-one-bits.
diff --git a/lib/hamt.c b/lib/hamt.c
index 8591852db9..3fbb68e402 100644
--- a/lib/hamt.c
+++ b/lib/hamt.c
@@ -22,8 +22,8 @@
#include <flexmember.h>
#include <inttypes.h>
+#include <stdbit.h>
#include <stdlib.h>
-#include "count-one-bits.h"
#include "verify.h"
#include "xalloc.h"
@@ -240,9 +240,7 @@ is_shared (const Hamt_entry *entry)
static int
trienode_count (const struct subtrie *subtrie)
{
- return count_one_bits (subtrie->map); /* In Gnulib, we assume that
- an integer has at least 32
- bits. */
+ return stdc_count_ones (subtrie->map);
}
/* Allocate a partially initialized subtrie with a given number of nodes. */
@@ -481,7 +479,7 @@ subtrie_lookup (const struct function_table *functions,
if (! (map & (1 << i)))
return NULL;
- int j = i == 0 ? 0 : count_one_bits (map << (32 - i));
+ int j = i == 0 ? 0 : stdc_count_ones (map << (32 - i));
return entry_lookup (functions, subtrie->nodes[j], elt, hash >> 5);
}
@@ -623,7 +621,7 @@ subtrie_insert (const struct function_table *functions,
struct subtrie *subtrie,
{
uint32_t map = subtrie->map;
int i = hash & 31;
- int j = i == 0 ? 0 : count_one_bits (map << (32 - i));
+ int j = i == 0 ? 0 : stdc_count_ones (map << (32 - i));
if (map & (1 << i))
{
Hamt_entry *entry = subtrie->nodes[j];
@@ -777,7 +775,7 @@ subtrie_remove (const struct function_table *functions,
struct subtrie *subtrie,
{
uint32_t map = subtrie->map;
int i = hash & 31;
- int j = i == 0 ? 0 : count_one_bits (map << (32 - i));
+ int j = i == 0 ? 0 : stdc_count_ones (map << (32 - i));
if (map & (1 << i))
{
Hamt_entry *entry = subtrie->nodes[j];
diff --git a/modules/hamt b/modules/hamt
index 7b6724949b..d8b892b7f6 100644
--- a/modules/hamt
+++ b/modules/hamt
@@ -6,7 +6,7 @@ lib/hamt.h
lib/hamt.c
Depends-on:
-count-one-bits
+stdc_count_ones
extern-inline
flexmember
inttypes-h-incomplete