changeset 1132:4f16fad0dd09 draft

Open hash fix. i*i -> i.
author yutaka@localhost.localdomain
date Tue, 15 Feb 2011 19:21:03 +0900
parents 220f9032d2d2
children bb17a03bab60
files TaskManager/kernel/memory/MemHash.cc
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/kernel/memory/MemHash.cc	Sun Feb 13 23:29:11 2011 +0900
+++ b/TaskManager/kernel/memory/MemHash.cc	Tue Feb 15 19:21:03 2011 +0900
@@ -60,7 +60,7 @@
     unsigned int hashval = hash(key);
 
     for (int i = 0; i < hashSize/2; i++) {
-        unsigned int index = (hashval + i*i)%hashSize;
+        unsigned int index = (hashval + i)%hashSize;
 
         if (table[index] == 0) { // 空の table に入れる
             table[index] = data;
@@ -79,7 +79,7 @@
     //printf("get hash value %d\n",hashval);
 
     for (int i = 0; i < hashSize/2; i++) {
-        unsigned int index = (hashval + i*i)%hashSize;
+        unsigned int index = (hashval + i)%hashSize;
 
         if (table[index] != NULL &&
             table[index]->address == key) {
@@ -100,7 +100,7 @@
     unsigned int hashval = hash(key);
 
     for (int i = 0; i < hashSize/2; i++) {
-        int index = (hashval + i*i)%hashSize;
+        int index = (hashval + i)%hashSize;
 
         if (table[index] != NULL &&
             table[index]->address == key) {