89 {
90 nLookups++;
91 if(nLookups > nThold) {
92 double NewHitRate = (double)nHits / nLookups;
93 if(nVerbose >= 2)
94 std::cout << "Cache Hits: " << std::setw(10) << nHits << ", "
95 << "Lookups: " << std::setw(10) << nLookups << ", "
96 << "Rate: " << std::setw(10) << NewHitRate
97 << std::endl;
98 if(NewHitRate > HitRate)
100 if(nSize == nMax)
101 nThold = SizeMax();
102 else {
103 nThold <<= 1;
104 if(!nThold)
105 nThold = SizeMax();
106 }
107 HitRate = NewHitRate;
108 }
109 cac i = (CacHash(x, y) & Mask) * 3;
110 if(vCache[i] == x && vCache[i + 1] == y) {
111 if(nVerbose >= 3)
112 std::cout << "Cache hit: "
113 << "x = " << std::setw(10) << x << ", "
114 << "y = " << std::setw(10) << y << ", "
115 << "z = " << std::setw(10) << vCache[i + 2] << ", "
116 << "hash = " << std::hex << (CacHash(x, y) & Mask) << std::dec
117 << std::endl;
118 nHits++;
119 return vCache[i + 2];
120 }
121 return LitMax();
122 }