]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.37
authorfred <fred>
Tue, 26 Mar 2002 21:48:37 +0000 (21:48 +0000)
committerfred <fred>
Tue, 26 Mar 2002 21:48:37 +0000 (21:48 +0000)
flower/include/hash-table.hh

index ef497f1c757185607eefb6d23d395572e99fdaa4..3ce52c944ca2a43e066c95282822aca08ce6d8f6 100644 (file)
 
 unsigned int int_hash (int);
 unsigned long prime_list (int idx);
+
+template<class K>
+unsigned int
+pointer_hash (K *p)
+{
+  return int_hash ((unsigned int) p);
+}
+
 template<class K, class V>
 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<K,V>*)this)->elem (k);
+      assert (elem_b (k));
+      retval = ((Hash_table<K,V>*)this)->elem (k);
       return retval;
   }
   V& operator [] (K k)