void
aspath_init (void)
{
- ashash = hash_create_size (32767, aspath_key_make, aspath_cmp);
+ ashash = hash_create_size (32768, aspath_key_make, aspath_cmp);
}
void
{
struct hash *hash;
+ assert ((size & (size-1)) == 0);
hash = XMALLOC (MTYPE_HASH, sizeof (struct hash));
hash->index = XCALLOC (MTYPE_HASH_INDEX,
sizeof (struct hash_backet *) * size);
struct hash_backet *backet;
key = (*hash->hash_key) (data);
- index = key % hash->size;
+ index = key & (hash->size - 1);
for (backet = hash->index[index]; backet != NULL; backet = backet->next)
if (backet->key == key && (*hash->hash_cmp) (backet->data, data))
struct hash_backet *pp;
key = (*hash->hash_key) (data);
- index = key % hash->size;
+ index = key & (hash->size - 1);
for (backet = pp = hash->index[index]; backet; backet = backet->next)
{
{
if (cpu_record == NULL)
cpu_record
- = hash_create_size (1011, (unsigned int (*) (void *))cpu_record_hash_key,
- (int (*) (const void *, const void *))cpu_record_hash_cmp);
+ = hash_create ((unsigned int (*) (void *))cpu_record_hash_key,
+ (int (*) (const void *, const void *))cpu_record_hash_cmp);
return (struct thread_master *) XCALLOC (MTYPE_THREAD_MASTER,
sizeof (struct thread_master));