mirror of
https://github.com/ShikyC/Taiko-Drum-Controller-Arduino.git
synced 2024-11-23 22:10:58 +01:00
Revert to original cache implementation
This commit is contained in:
parent
5d13e11853
commit
b76a5f1da7
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user