From b9f90cafa1c09dd42bfae456ae08be9e826a7d11 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 10 Feb 2023 03:42:50 +0000 Subject: [PATCH] st.c: spell `perturb' properly Otherwise, a reader may wonder who `Peter B.' is and why a variable is named after them... --- st.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/st.c b/st.c index 0fb8f82bc3d523..b18b9d6cb948bb 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 } }