69 {
70 nLookups++;
71 if(nLookups > nThold) {
72 double NewHitRate = (double)nHits / nLookups;
73 if(nVerbose >= 2)
74 std::cout << "Cache Hits: " << std::setw(10) << nHits << ", "
75 << "Lookups: " << std::setw(10) << nLookups << ", "
76 << "Rate: " << std::setw(10) << NewHitRate
77 << std::endl;
78 if(NewHitRate > HitRate)
80 if(nSize == nMax)
81 nThold = SizeMax();
82 else {
83 nThold <<= 1;
84 if(!nThold)
85 nThold = SizeMax();
86 }
87 HitRate = NewHitRate;
88 }
89 cac i = (CacHash(x, y) & Mask) * 3;
90 if(vCache[i] == x && vCache[i + 1] == y) {
91 if(nVerbose >= 3)
92 std::cout << "Cache hit: "
93 << "x = " << std::setw(10) << x << ", "
94 << "y = " << std::setw(10) << y << ", "
95 << "z = " << std::setw(10) << vCache[i + 2] << ", "
96 << "hash = " << std::hex << (CacHash(x, y) & Mask) << std::dec
97 << std::endl;
98 nHits++;
99 return vCache[i + 2];
100 }
101 return LitMax();
102 }