Mercurial > hg > openttd
changeset 16187:e04d95503c79 draft
(svn r20887) -Codechange: Make stat_Hash a method.
author | alberth <alberth@openttd.org> |
---|---|
date | Sat, 02 Oct 2010 19:47:21 +0000 |
parents | 0cf955e82964 |
children | 97c7bf3f1368 |
files | src/pathfinder/npf/queue.cpp src/pathfinder/npf/queue.h |
diffstat | 2 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pathfinder/npf/queue.cpp +++ b/src/pathfinder/npf/queue.cpp @@ -303,7 +303,7 @@ } #ifdef HASH_STATS -static void stat_Hash(const Hash *h) +void Hash::PrintStatistics() const { uint used_buckets = 0; uint max_collision = 0; @@ -312,13 +312,13 @@ uint i; for (i = 0; i < lengthof(usage); i++) usage[i] = 0; - for (i = 0; i < h->num_buckets; i++) { + for (i = 0; i < this->num_buckets; i++) { uint collision = 0; - if (h->buckets_in_use[i]) { + if (this->buckets_in_use[i]) { const HashNode *node; used_buckets++; - for (node = &h->buckets[i]; node != NULL; node = node->next) collision++; + for (node = &this->buckets[i]; node != NULL; node = node->next) collision++; if (collision > max_collision) max_collision = collision; } if (collision >= lengthof(usage)) collision = lengthof(usage) - 1; @@ -333,7 +333,7 @@ "Nodes used: %d\n" "Non empty buckets: %d\n" "Max collision: %d\n", - h->num_buckets, h->size, used_buckets, max_collision + this->num_buckets, this->size, used_buckets, max_collision ); printf("{ "); for (i = 0; i <= max_collision; i++) {