Revert to original cache implementation

This commit is contained in:
ShikyC 2024-01-31 21:03:28 -08:00
parent 5d13e11853
commit b76a5f1da7

View File

@ -16,11 +16,11 @@ class Cache {
public: public:
Cache() { memset(data_, 0, sizeof(data_)); } Cache() { memset(data_, 0, sizeof(data_)); }
inline void put(T value) { inline void put(T value) {
current_ = (current_ + 1) & (L - 1); current_ = (current_ + 1) % L;
data_[current_] = value; data_[current_] = value;
} }
inline T get(int offset = 0) const { inline T get(int offset = 0) const {
return data_[(current_ + offset) & (L - 1)]; return data_[(current_ + offset) % L];
} }
private: private: