aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorEric Wong <normal@ruby-lang.org>2023-02-10 03:42:50 +0000
committerEric Wong <normal@ruby-lang.org>2023-02-10 03:50:31 +0000
commitb9f90cafa1c09dd42bfae456ae08be9e826a7d11 (patch)
treee3910e74eba368c66627c9dda35cf0cf63032a67 /st.c
parent94aed6ece5517344760816e521ee5d62366dfafb (diff)
downloadruby-b9f90cafa1c09dd42bfae456ae08be9e826a7d11.tar.gz
st.c: spell `perturb' properly
Otherwise, a reader may wonder who `Peter B.' is and why a variable is named after them...
Diffstat (limited to 'st.c')
-rw-r--r--st.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/st.c b/st.c
index 0fb8f82bc3..b18b9d6cb9 100644
--- a/st.c
+++ b/st.c
@@ -768,7 +768,7 @@ rebuild_table(st_table *tab)
}
/* 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
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. */
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;
- ind = (ind << 2) + ind + *perterb + 1;
+ *perturb >>= 11;
+ ind = (ind << 2) + ind + *perturb + 1;
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
st_index_t d;
#else
- st_index_t peterb;
+ st_index_t perturb;
#endif
st_index_t bin;
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
d = 1;
#else
- peterb = hash_value;
+ perturb = hash_value;
#endif
FOUND_BIN;
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);
d++;
#else
- ind = secondary_hash(ind, tab, &peterb);
+ ind = secondary_hash(ind, tab, &perturb);
#endif
COLLISION;
}
@@ -872,7 +872,7 @@ find_table_bin_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
#ifdef QUADRATIC_PROBE
st_index_t d;
#else
- st_index_t peterb;
+ st_index_t perturb;
#endif
st_index_t bin;
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
d = 1;
#else
- peterb = hash_value;
+ perturb = hash_value;
#endif
FOUND_BIN;
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);
d++;
#else
- ind = secondary_hash(ind, tab, &peterb);
+ ind = secondary_hash(ind, tab, &perturb);
#endif
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
st_index_t d;
#else
- st_index_t peterb;
+ st_index_t perturb;
#endif
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
d = 1;
#else
- peterb = hash_value;
+ perturb = hash_value;
#endif
FOUND_BIN;
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);
d++;
#else
- ind = secondary_hash(ind, tab, &peterb);
+ ind = secondary_hash(ind, tab, &perturb);
#endif
COLLISION;
}
@@ -960,7 +960,7 @@ find_table_bin_ptr_and_reserve(st_table *tab, st_hash_t *hash_value,
#ifdef QUADRATIC_PROBE
st_index_t d;
#else
- st_index_t peterb;
+ st_index_t perturb;
#endif
st_index_t entry_index;
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
d = 1;
#else
- peterb = curr_hash_value;
+ perturb = curr_hash_value;
#endif
FOUND_BIN;
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);
d++;
#else
- ind = secondary_hash(ind, tab, &peterb);
+ ind = secondary_hash(ind, tab, &perturb);
#endif
COLLISION;
}
@@ -2120,7 +2120,7 @@ st_rehash_indexed(st_table *tab)
#ifdef QUADRATIC_PROBE
st_index_t d = 1;
#else
- st_index_t peterb = p->hash;
+ st_index_t perturb = p->hash;
#endif
if (DELETED_ENTRY_P(p))
@@ -2153,7 +2153,7 @@ st_rehash_indexed(st_table *tab)
ind = hash_bin(ind + d, tab);
d++;
#else
- ind = secondary_hash(ind, tab, &peterb);
+ ind = secondary_hash(ind, tab, &perturb);
#endif
}
}