jnk0le / Ring-Buffer

simple C++11 ring buffer implementation, allocated and evaluated at compile time
MIT License
380 stars 64 forks source link

Max size of head/tail #25

Open ongkoonhan opened 1 month ago

ongkoonhan commented 1 month ago

I noticed the implementation only increments head/tail atomic size_t variables. If head/tail reaches the max value of size_t and overflows, does the implementation still perform as expected?

jnk0le commented 1 month ago

yes, as the two's complement numbers add/subtract correctly across unsigned overflow.