OSDN Git Service

runtime: correct a logic error in hashmap growth.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jul 2012 03:57:53 +0000 (03:57 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Jul 2012 03:57:53 +0000 (03:57 +0000)
The bug prevented maps to grow properly to sizes
larger than 1.3 million.

From Rémy Oudompheng.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189767 138bc75d-0d04-0410-961f-82ee72b054a4

libgo/runtime/go-new-map.c

index eef71dd..6446618 100644 (file)
@@ -90,9 +90,9 @@ __go_map_next_prime (uintptr_t n)
       /* Here LOW <= MID < HIGH.  */
 
       if (prime_list[mid] < n)
       /* Here LOW <= MID < HIGH.  */
 
       if (prime_list[mid] < n)
-       high = mid;
-      else if (prime_list[mid] > n)
        low = mid + 1;
        low = mid + 1;
+      else if (prime_list[mid] > n)
+       high = mid;
       else
        return n;
     }
       else
        return n;
     }