From b76a5f1da7953fed8066bce3e872bc60226a56cd Mon Sep 17 00:00:00 2001 From: ShikyC Date: Wed, 31 Jan 2024 21:03:28 -0800 Subject: [PATCH] Revert to original cache implementation --- ESP32-S3-Analog/cache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ESP32-S3-Analog/cache.h b/ESP32-S3-Analog/cache.h index 5d73956..3210248 100644 --- a/ESP32-S3-Analog/cache.h +++ b/ESP32-S3-Analog/cache.h @@ -16,11 +16,11 @@ class Cache { public: Cache() { memset(data_, 0, sizeof(data_)); } inline void put(T value) { - current_ = (current_ + 1) & (L - 1); + current_ = (current_ + 1) % L; data_[current_] = value; } inline T get(int offset = 0) const { - return data_[(current_ + offset) & (L - 1)]; + return data_[(current_ + offset) % L]; } private: