Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/test_render/spe/TileHash.cpp @ 380:b4b8345b5366
ps3 fix
author | e065701@localhost.localdomain |
---|---|
date | Fri, 31 Jul 2009 20:44:08 +0900 |
parents | 3f5289873643 |
children |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/TileHash.cpp Fri Jul 31 19:24:38 2009 +0900 +++ b/TaskManager/Test/test_render/spe/TileHash.cpp Fri Jul 31 20:44:08 2009 +0900 @@ -8,15 +8,15 @@ }; int -TileHash::hash(uint32 data) +TileHash::hash(memaddr data) { int value = 0; int n = 0; int key; - for (int i = 0; i < 8; i ++) { + for (uint32 i = 0; i < sizeof(memaddr) * 2; i ++) { key = data & 0xf; - value += key * PRIME[n++]; + value += key * PRIME[n++ & 7]; data >>= 4; } @@ -33,9 +33,9 @@ } int -TileHash::put(uint32 *key, TilePtr data) +TileHash::put(memaddr key, TilePtr data) { - int hashval = hash((uint32)key); + int hashval = hash(key); for (int i = 0; i < hashSize/2; i++) { int index = (hashval + i*i)%hashSize; @@ -50,15 +50,15 @@ } TilePtr -TileHash::get(uint32 *key) +TileHash::get(memaddr key) { - int hashval = hash((uint32)key); + int hashval = hash(key); for (int i = 0; i < hashSize/2; i++) { int index = (hashval + i*i)%hashSize; if (table[index] != NULL && - table[index]->texture_addr == key) { + table[index]->address == key) { return table[index]; } } @@ -67,15 +67,15 @@ } void -TileHash::remove(uint32 *key) +TileHash::remove(memaddr key) { - int hashval = hash((uint32)key); + int hashval = hash(key); for (int i = 0; i < hashSize/2; i++) { int index = (hashval + i*i)%hashSize; if (table[index] != NULL && - table[index]->texture_addr == key) { + table[index]->address == key) { table[index] = NULL; } }