Files Classes Functions Hierarchy
#include <hashfunction01.h>
Public Member Functions | |
| hashfunction01 () | |
| Construct in bad state. | |
| void | construct (uint nloops_) |
| Construct class. | |
| hashfunction01 (uintc nloops_) | |
| Control the number of loops, must be greater than 0. | |
| uintc | operator() (uintc key) const |
| Hash an integer to another integer. | |
Public Attributes | |
| uint | nloops |
| The number of loops in the hash function. | |
Definition at line 14 of file hashfunction01.h.
| hashfunction01::hashfunction01 | ( | ) |
| hashfunction01::hashfunction01 | ( | uintc | nloops_ | ) |
Control the number of loops, must be greater than 0.
Definition at line 7 of file hashfunction01.cpp.
00008 : nloops(loops_) {}
| void hashfunction01::construct | ( | uint | nloops_ | ) | [inline] |
Construct class.
Definition at line 25 of file hashfunction01.h.
References nloops.
Referenced by stringhash::construct().
00026 { nloops=nloops_; }
Hash an integer to another integer.
Definition at line 11 of file hashfunction01.cpp.
References nloops.
00012 { 00013 uint h = key; 00014 uint i; 00015 00016 assert(nloops!=0); 00017 00018 for (i=0; i<nloops; ++i) 00019 { 00020 h += ~(h << 15); 00021 h ^= (h >> 10); 00022 h += (h << 3); 00023 h ^= (h >> 6); 00024 h += ~(h << 11); 00025 h ^= (h >> 10); 00026 } 00027 00028 return h; 00029 }
The number of loops in the hash function.
Definition at line 19 of file hashfunction01.h.
Referenced by construct(), and operator()().
1.5.8