STON_FUNC
uint32_t ston_ht32_insert(ston_ht,uint32_t,uint16_t,uint32_t);
STON_FUNC
uint32_t ston_ht32_insert(ston_ht,uint32_t,uint16_t,uint32_t);
-#define ston_ht32_new(_COL,_N,_FN) ston_ht32_create(_COLS,ston_up2pow(_N << 1),0,_FN)
+#define ston_ht32_new(_COL,_N,_F,_FN) ston_ht32_create(_COLS,ston_up2pow(_N << 1),_F,_FN)
#define ston_ht32_col(_HT,_KEY,_COL) (ston_ht32_row(_HT,_KEY) + _COL)
#define ston_ht32_insertx(_HT,_KEY,_COL,_VAL) *ston_ht32_col(_HT,_KEY,_COL) = _VAL
#define ston_ht_size(_HT) ((_HT)->ht_columns << (_HT)->ht_2pow)
#define ston_ht32_col(_HT,_KEY,_COL) (ston_ht32_row(_HT,_KEY) + _COL)
#define ston_ht32_insertx(_HT,_KEY,_COL,_VAL) *ston_ht32_col(_HT,_KEY,_COL) = _VAL
#define ston_ht_size(_HT) ((_HT)->ht_columns << (_HT)->ht_2pow)
- single size_t bytes, a column count, and a row count which estimates the
- number of unique keys held in the table. The provided ht_rows is doubled,
- and rounded up to the nearest power of two to create a hash table with
- minimal collisions.
+ single size_t bytes, a column count, and a row count which determines the
+ size of the table.
+
+ use ston_ht32_new to specify the exact or estimated number of unique keys
+ held in the table. With ston_ht32_new, the provided ht_rows is doubled, and
+ rounded up to the nearest power of two to create a hash table with minimal
+ collisions.
ston_ht ht = (ston_ht) alloc_fn(sizeof(struct ston_ht_header_t) + ht_size);
if (ht != NULL)
{ for (ht->ht_2pow = 0; ht_size; ht->ht_2pow++)
ston_ht ht = (ston_ht) alloc_fn(sizeof(struct ston_ht_header_t) + ht_size);
if (ht != NULL)
{ for (ht->ht_2pow = 0; ht_size; ht->ht_2pow++)