st.c: spell `perturb' properly
Otherwise, a reader may wonder who `Peter B.' is and why a variable is named after them...
This commit is contained in:
parent
94aed6ece5
commit
b9f90cafa1
36
st.c
36
st.c
@ -768,7 +768,7 @@ rebuild_table(st_table *tab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return the next secondary hash index for table TAB using previous
|
/* Return the next secondary hash index for table TAB using previous
|
||||||
index IND and PERTERB. Finally modulo of the function becomes a
|
index IND and PERTURB. Finally modulo of the function becomes a
|
||||||
full *cycle linear congruential generator*, in other words it
|
full *cycle linear congruential generator*, in other words it
|
||||||
guarantees traversing all table bins in extreme case.
|
guarantees traversing all table bins in extreme case.
|
||||||
|
|
||||||
@ -780,10 +780,10 @@ rebuild_table(st_table *tab)
|
|||||||
|
|
||||||
For our case a is 5, c is 1, and m is a power of two. */
|
For our case a is 5, c is 1, and m is a power of two. */
|
||||||
static inline st_index_t
|
static inline st_index_t
|
||||||
secondary_hash(st_index_t ind, st_table *tab, st_index_t *perterb)
|
secondary_hash(st_index_t ind, st_table *tab, st_index_t *perturb)
|
||||||
{
|
{
|
||||||
*perterb >>= 11;
|
*perturb >>= 11;
|
||||||
ind = (ind << 2) + ind + *perterb + 1;
|
ind = (ind << 2) + ind + *perturb + 1;
|
||||||
return hash_bin(ind, tab);
|
return hash_bin(ind, tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ find_table_entry_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
st_index_t d;
|
st_index_t d;
|
||||||
#else
|
#else
|
||||||
st_index_t peterb;
|
st_index_t perturb;
|
||||||
#endif
|
#endif
|
||||||
st_index_t bin;
|
st_index_t bin;
|
||||||
st_table_entry *entries = tab->entries;
|
st_table_entry *entries = tab->entries;
|
||||||
@ -835,7 +835,7 @@ find_table_entry_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
d = 1;
|
d = 1;
|
||||||
#else
|
#else
|
||||||
peterb = hash_value;
|
perturb = hash_value;
|
||||||
#endif
|
#endif
|
||||||
FOUND_BIN;
|
FOUND_BIN;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -853,7 +853,7 @@ find_table_entry_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
ind = hash_bin(ind + d, tab);
|
ind = hash_bin(ind + d, tab);
|
||||||
d++;
|
d++;
|
||||||
#else
|
#else
|
||||||
ind = secondary_hash(ind, tab, &peterb);
|
ind = secondary_hash(ind, tab, &perturb);
|
||||||
#endif
|
#endif
|
||||||
COLLISION;
|
COLLISION;
|
||||||
}
|
}
|
||||||
@ -872,7 +872,7 @@ find_table_bin_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
st_index_t d;
|
st_index_t d;
|
||||||
#else
|
#else
|
||||||
st_index_t peterb;
|
st_index_t perturb;
|
||||||
#endif
|
#endif
|
||||||
st_index_t bin;
|
st_index_t bin;
|
||||||
st_table_entry *entries = tab->entries;
|
st_table_entry *entries = tab->entries;
|
||||||
@ -881,7 +881,7 @@ find_table_bin_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
d = 1;
|
d = 1;
|
||||||
#else
|
#else
|
||||||
peterb = hash_value;
|
perturb = hash_value;
|
||||||
#endif
|
#endif
|
||||||
FOUND_BIN;
|
FOUND_BIN;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -899,7 +899,7 @@ find_table_bin_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
ind = hash_bin(ind + d, tab);
|
ind = hash_bin(ind + d, tab);
|
||||||
d++;
|
d++;
|
||||||
#else
|
#else
|
||||||
ind = secondary_hash(ind, tab, &peterb);
|
ind = secondary_hash(ind, tab, &perturb);
|
||||||
#endif
|
#endif
|
||||||
COLLISION;
|
COLLISION;
|
||||||
}
|
}
|
||||||
@ -916,7 +916,7 @@ find_table_bin_ind_direct(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
st_index_t d;
|
st_index_t d;
|
||||||
#else
|
#else
|
||||||
st_index_t peterb;
|
st_index_t perturb;
|
||||||
#endif
|
#endif
|
||||||
st_index_t bin;
|
st_index_t bin;
|
||||||
|
|
||||||
@ -924,7 +924,7 @@ find_table_bin_ind_direct(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
d = 1;
|
d = 1;
|
||||||
#else
|
#else
|
||||||
peterb = hash_value;
|
perturb = hash_value;
|
||||||
#endif
|
#endif
|
||||||
FOUND_BIN;
|
FOUND_BIN;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -935,7 +935,7 @@ find_table_bin_ind_direct(st_table *tab, st_hash_t hash_value, st_data_t key)
|
|||||||
ind = hash_bin(ind + d, tab);
|
ind = hash_bin(ind + d, tab);
|
||||||
d++;
|
d++;
|
||||||
#else
|
#else
|
||||||
ind = secondary_hash(ind, tab, &peterb);
|
ind = secondary_hash(ind, tab, &perturb);
|
||||||
#endif
|
#endif
|
||||||
COLLISION;
|
COLLISION;
|
||||||
}
|
}
|
||||||
@ -960,7 +960,7 @@ find_table_bin_ptr_and_reserve(st_table *tab, st_hash_t *hash_value,
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
st_index_t d;
|
st_index_t d;
|
||||||
#else
|
#else
|
||||||
st_index_t peterb;
|
st_index_t perturb;
|
||||||
#endif
|
#endif
|
||||||
st_index_t entry_index;
|
st_index_t entry_index;
|
||||||
st_index_t first_deleted_bin_ind;
|
st_index_t first_deleted_bin_ind;
|
||||||
@ -970,7 +970,7 @@ find_table_bin_ptr_and_reserve(st_table *tab, st_hash_t *hash_value,
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
d = 1;
|
d = 1;
|
||||||
#else
|
#else
|
||||||
peterb = curr_hash_value;
|
perturb = curr_hash_value;
|
||||||
#endif
|
#endif
|
||||||
FOUND_BIN;
|
FOUND_BIN;
|
||||||
first_deleted_bin_ind = UNDEFINED_BIN_IND;
|
first_deleted_bin_ind = UNDEFINED_BIN_IND;
|
||||||
@ -1000,7 +1000,7 @@ find_table_bin_ptr_and_reserve(st_table *tab, st_hash_t *hash_value,
|
|||||||
ind = hash_bin(ind + d, tab);
|
ind = hash_bin(ind + d, tab);
|
||||||
d++;
|
d++;
|
||||||
#else
|
#else
|
||||||
ind = secondary_hash(ind, tab, &peterb);
|
ind = secondary_hash(ind, tab, &perturb);
|
||||||
#endif
|
#endif
|
||||||
COLLISION;
|
COLLISION;
|
||||||
}
|
}
|
||||||
@ -2120,7 +2120,7 @@ st_rehash_indexed(st_table *tab)
|
|||||||
#ifdef QUADRATIC_PROBE
|
#ifdef QUADRATIC_PROBE
|
||||||
st_index_t d = 1;
|
st_index_t d = 1;
|
||||||
#else
|
#else
|
||||||
st_index_t peterb = p->hash;
|
st_index_t perturb = p->hash;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (DELETED_ENTRY_P(p))
|
if (DELETED_ENTRY_P(p))
|
||||||
@ -2153,7 +2153,7 @@ st_rehash_indexed(st_table *tab)
|
|||||||
ind = hash_bin(ind + d, tab);
|
ind = hash_bin(ind + d, tab);
|
||||||
d++;
|
d++;
|
||||||
#else
|
#else
|
||||||
ind = secondary_hash(ind, tab, &peterb);
|
ind = secondary_hash(ind, tab, &perturb);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user