]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/hash-table.hh
patch::: 1.3.49.hwn1: deze dus
[lilypond.git] / flower / include / hash-table.hh
index 491feb3df7106fab4674d04c2421ad66bb383e10..f3f5bfe23402768e46f5206593b24abc5fd186d3 100644 (file)
@@ -43,7 +43,9 @@ struct Hash_table_entry
    A hash table of prime size.
 
    We use quadratic probing.  
- */
+
+  DEPRECATED. Use either SCM (preferred) or STL 
+*/
 template<class K, class V>
 class Fixed_size_hash_table
 {
@@ -61,9 +63,12 @@ public:
   int lookup  (K s, unsigned int initial_hash)
     {
       int sz =dict_arr_.size ();
-      int i = initial_hash % sz;
+      initial_hash = initial_hash % sz; 
+      int i;
       int j = 0;
       while (j <= sz/2) {
+       i = (initial_hash + j*j) % sz;
+       
        if (dict_arr_[i].free_b_)
          return i;
 
@@ -71,7 +76,6 @@ public:
          return i;
 
        j++;
-       i = (i + j*j) % sz;
       }
 
       
@@ -151,8 +155,8 @@ public:
     }
 
   /**
-     Find and return element.  If #s# is not in the table, create an entry in the table, and init
-   */
+     Find and return element.  If #s# is not in the table, create an
+     entry in the table, and init */
   V& elem (K s)
     {
       int l;