Re:I've been writing ring buffers wrong all these years
by lorenzhs on Wednesday December 14, 2016 @05:36PM
(#13180329)
That only works for compile time constants, though. With a power of two sized buffer you can just store the mask and decide how large you want your buffer to be at runtime.
[ Parent
| on HN ]
Re:I've been writing ring buffers wrong all these years
by _ihaque on Wednesday December 14, 2016 @07:32PM
(#13181173)
libdivide (http://libdivide.com) implements similar logic at runtime