3 ms·
> You mention a circular buffer as an outlier but you simply have to decide where it (the buffer) started off life - 0 or 1 or something else. No. A circular b
by cyberax 3y ago
> You mention a circular buffer as an outlier but you simply have to decide where it (the buffer) started off life - 0 or 1 or something else.
No. A circular buffer is just a simple example where you need to go between offsets and locations.
The same theme happens in many similar cases, like directly manipulating bitmaps. E.g. with zero-based indexing into an RGB bitmap:
bitmap[y*width*3 + x*3] = 1
vs. 1-based indexes:
bitmap[(y-1)*width*3 + (x-1)*3 + 1] = 1