mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-04-28 06:33:36 +00:00
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.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2026-03-15 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
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.
|
||||
|
||||
2026-03-15 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
count-*: Fix module status (regression yesterday).
|
||||
|
||||
12
lib/hamt.c
12
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];
|
||||
|
||||
@@ -6,7 +6,7 @@ lib/hamt.h
|
||||
lib/hamt.c
|
||||
|
||||
Depends-on:
|
||||
count-one-bits
|
||||
stdc_count_ones
|
||||
extern-inline
|
||||
flexmember
|
||||
inttypes-h-incomplete
|
||||
|
||||
Reference in New Issue
Block a user