Circular buffer wrap around with chorus effect
If I understood correctly what you are asking, then this is probably more of a programming question... But the solution would be to use modular arithmetic to compute the position of the delay. With a length equal to a power of 2, this could be accomplished with an AND instruction.

const int Mask = (1 &lt;&lt; 16) - 1;
Circular_Array[(Current_Position_in_Buffer - Delay) &amp; Mask];


In this example, the length of your buffer is $2^{16}$.

More generally you can use the modulo operator, but it will be slower.