From 8962b7d96b97ca01edf85fbe0df0d21af4fc3c0a Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:48:37 +0000 Subject: [PATCH] lilypond-1.1.37 --- flower/include/hash-table.hh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/flower/include/hash-table.hh b/flower/include/hash-table.hh index ef497f1c75..3ce52c944c 100644 --- a/flower/include/hash-table.hh +++ b/flower/include/hash-table.hh @@ -12,6 +12,14 @@ unsigned int int_hash (int); unsigned long prime_list (int idx); + +template +unsigned int +pointer_hash (K *p) +{ + return int_hash ((unsigned int) p); +} + template struct Hash_table_entry { @@ -71,16 +79,19 @@ public: /// remove #s# from the hash table. V remove (K s, unsigned int initial_hash) { - assert (false); // Untested routine. int sz =dict_arr_.size (); int i = initial_hash % sz; int j = 0; V retval; + + /* + duplicate with lookup, but we need value of j + */ + while (j <= sz/2 && dict_arr_[i].key_ != s) { assert (!dict_arr_[i].free_b_); - - + j ++; i = (i + j*j) % sz; } @@ -187,8 +198,8 @@ public: V const_elem (K k) const { V retval; - if (elem_b (k)) - retval = ((Hash_table*)this)->elem (k); + assert (elem_b (k)); + retval = ((Hash_table*)this)->elem (k); return retval; } V& operator [] (K k) -- 2.39.5