Circular / ring buffers in R and C. There are a couple of different buffers here with different implementations that represent different trade-offs.