2 #ifndef __circularbuffer__
3 #define __circularbuffer__
12 template <
typename T, u
int32_t N>
21 *ptr = (*ptr + increment) % wrap_len;
24 void add(
const T ch) {
30 return this->
buf(this->
pos);
33 T
get(int32_t offset) {
35 int32_t position_to_get = ((this->
pos+offset) % this->
len);
37 if (position_to_get < 0) {
38 return this->
buf[position_to_get + this->
len];
40 return this->
buf[position_to_get];
void increment_ptr(uint32_t *ptr, uint32_t increment, uint32_t wrap_len)