3 ms·
No, I think the author is using the full range of a 32 bit int. So read could be any 32 bit integer, even if the size of the ring is 1. (The trick is that SIZE
by nickodell 10y ago
No, I think the author is using the full range of a 32 bit int. So read could be any 32 bit integer, even if the size of the ring is 1.
(The trick is that SIZE has to be a power of two, or else when you increment from 2^32-1 to 0, your pointers will jump to a different position in the array.)