Skip to content

Commit b9f90ca

Browse files
author
Eric Wong
committed
st.c: spell `perturb' properly
Otherwise, a reader may wonder who `Peter B.' is and why a variable is named after them...
1 parent 94aed6e commit b9f90ca

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

st.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ rebuild_table(st_table *tab)
768768
}
769769

770770
/* Return the next secondary hash index for table TAB using previous
771-
index IND and PERTERB. Finally modulo of the function becomes a
771+
index IND and PERTURB. Finally modulo of the function becomes a
772772
full *cycle linear congruential generator*, in other words it
773773
guarantees traversing all table bins in extreme case.
774774
@@ -780,10 +780,10 @@ rebuild_table(st_table *tab)
780780
781781
For our case a is 5, c is 1, and m is a power of two. */
782782
static inline st_index_t
783-
secondary_hash(st_index_t ind, st_table *tab, st_index_t *perterb)
783+
secondary_hash(st_index_t ind, st_table *tab, st_index_t *perturb)
784784
{
785-
*perterb >>= 11;
786-
ind = (ind << 2) + ind + *perterb + 1;
785+
*perturb >>= 11;
786+
ind = (ind << 2) + ind + *perturb + 1;
787787
return hash_bin(ind, tab);
788788
}
789789

@@ -826,7 +826,7 @@ find_table_entry_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
826826
#ifdef QUADRATIC_PROBE
827827
st_index_t d;
828828
#else
829-
st_index_t peterb;
829+
st_index_t perturb;
830830
#endif
831831
st_index_t bin;
832832
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)
835835
#ifdef QUADRATIC_PROBE
836836
d = 1;
837837
#else
838-
peterb = hash_value;
838+
perturb = hash_value;
839839
#endif
840840
FOUND_BIN;
841841
for (;;) {
@@ -853,7 +853,7 @@ find_table_entry_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
853853
ind = hash_bin(ind + d, tab);
854854
d++;
855855
#else
856-
ind = secondary_hash(ind, tab, &peterb);
856+
ind = secondary_hash(ind, tab, &perturb);
857857
#endif
858858
COLLISION;
859859
}
@@ -872,7 +872,7 @@ find_table_bin_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
872872
#ifdef QUADRATIC_PROBE
873873
st_index_t d;
874874
#else
875-
st_index_t peterb;
875+
st_index_t perturb;
876876
#endif
877877
st_index_t bin;
878878
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)
881881
#ifdef QUADRATIC_PROBE
882882
d = 1;
883883
#else
884-
peterb = hash_value;
884+
perturb = hash_value;
885885
#endif
886886
FOUND_BIN;
887887
for (;;) {
@@ -899,7 +899,7 @@ find_table_bin_ind(st_table *tab, st_hash_t hash_value, st_data_t key)
899899
ind = hash_bin(ind + d, tab);
900900
d++;
901901
#else
902-
ind = secondary_hash(ind, tab, &peterb);
902+
ind = secondary_hash(ind, tab, &perturb);
903903
#endif
904904
COLLISION;
905905
}
@@ -916,15 +916,15 @@ find_table_bin_ind_direct(st_table *tab, st_hash_t hash_value, st_data_t key)
916916
#ifdef QUADRATIC_PROBE
917917
st_index_t d;
918918
#else
919-
st_index_t peterb;
919+
st_index_t perturb;
920920
#endif
921921
st_index_t bin;
922922

923923
ind = hash_bin(hash_value, tab);
924924
#ifdef QUADRATIC_PROBE
925925
d = 1;
926926
#else
927-
peterb = hash_value;
927+
perturb = hash_value;
928928
#endif
929929
FOUND_BIN;
930930
for (;;) {
@@ -935,7 +935,7 @@ find_table_bin_ind_direct(st_table *tab, st_hash_t hash_value, st_data_t key)
935935
ind = hash_bin(ind + d, tab);
936936
d++;
937937
#else
938-
ind = secondary_hash(ind, tab, &peterb);
938+
ind = secondary_hash(ind, tab, &perturb);
939939
#endif
940940
COLLISION;
941941
}
@@ -960,7 +960,7 @@ find_table_bin_ptr_and_reserve(st_table *tab, st_hash_t *hash_value,
960960
#ifdef QUADRATIC_PROBE
961961
st_index_t d;
962962
#else
963-
st_index_t peterb;
963+
st_index_t perturb;
964964
#endif
965965
st_index_t entry_index;
966966
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,
970970
#ifdef QUADRATIC_PROBE
971971
d = 1;
972972
#else
973-
peterb = curr_hash_value;
973+
perturb = curr_hash_value;
974974
#endif
975975
FOUND_BIN;
976976
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,
10001000
ind = hash_bin(ind + d, tab);
10011001
d++;
10021002
#else
1003-
ind = secondary_hash(ind, tab, &peterb);
1003+
ind = secondary_hash(ind, tab, &perturb);
10041004
#endif
10051005
COLLISION;
10061006
}
@@ -2120,7 +2120,7 @@ st_rehash_indexed(st_table *tab)
21202120
#ifdef QUADRATIC_PROBE
21212121
st_index_t d = 1;
21222122
#else
2123-
st_index_t peterb = p->hash;
2123+
st_index_t perturb = p->hash;
21242124
#endif
21252125

21262126
if (DELETED_ENTRY_P(p))
@@ -2153,7 +2153,7 @@ st_rehash_indexed(st_table *tab)
21532153
ind = hash_bin(ind + d, tab);
21542154
d++;
21552155
#else
2156-
ind = secondary_hash(ind, tab, &peterb);
2156+
ind = secondary_hash(ind, tab, &perturb);
21572157
#endif
21582158
}
21592159
}

0 commit comments

Comments
 (0)