rts/Hash.c
/* -----------------------------------------------------------------------------
 * When we initialize a hash table, we set up the first segment as well,
 * initializing all of the first segment's hash buckets to NULL.
 * -------------------------------------------------------------------------- */
When we initialize a hash table, we set up the first segment as well,
initializing all of the first segment's hash buckets to NULL.
When we initialize a hash table we set up the first segment as well initializing all of the first segment ' s hash buckets to NULL .
HashTable *
allocHashTable_(HashFunction *hash, CompareFunction *compare)
{
    HashTable *table;
    HashList **hb;
    table = stgMallocBytes(sizeof(HashTable),"allocHashTable");
    allocSegment(table, 0);
    for (hb = table->dir[0]; hb < table->dir[0] + HSEGSIZE; hb++)
        *hb = NULL;
    table->split = 0;
    table->max = HSEGSIZE;
    table->mask1 = HSEGSIZE - 1;
    table->mask2 = 2 * HSEGSIZE - 1;
    table->kcount = 0;
    table->bcount = HSEGSIZE;
    table->freeList = NULL;
    table->chunks = NULL;
    table->hash = hash;
    table->compare = compare;
    return table;
}
HashTable * allocHashTable_ ( HashFunction * hash , CompareFunction * compare ) { HashTable * table ; HashList * * hb ; table = stgMallocBytes ( sizeof ( HashTable ) , " " ) ; allocSegment ( table , 0 ) ; for ( hb = table -> dir [ 0 ] ; hb < table -> dir [ 0 ] + HSEGSIZE ; hb ++ ) * hb = NULL ; table -> split = 0 ; table -> max = HSEGSIZE ; table -> mask1 = HSEGSIZE - 1 ; table -> mask2 = 2 * HSEGSIZE - 1 ; table -> kcount = 0 ; table -> bcount = HSEGSIZE ; table -> freeList = NULL ; table -> chunks = NULL ; table -> hash = hash ; table -> compare = compare ; return table ; }
When we initialize a hash table, we set up the first segment as well,
 initializing all of the first segment's hash buckets to NULL.
When we initialize a hash table we set up the first segment as well initializing all of the first segment ' s hash buckets to NULL .