Skip to content

Commit 706d545

Browse files
committed
Tiny text tweak
1 parent 9b17182 commit 706d545

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Ring Buffer/README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ In other words, we take the modulo (or the remainder) of the read and write inde
129129

130130
The reason this is a bit controversial is that `writeIndex` and `readIndex` always increment, so in theory these values could become too large to fit into an integer and the app will crash. However, a quick back-of-the-napkin calculation should take away those fears.
131131

132-
Both `writeIndex` and `readIndex` are 64-bit integers. If we assume that they are incremented 1000 times per second, which is a lot, then doing this continuously for one year requires `ceil(log_2(365 * 24 * 60 * 60 * 1000)) = 35` bits. That gives us 28 bits to spare, so that should give you about 2^28 years before running into problems. That's a long time. :-)
132+
Both `writeIndex` and `readIndex` are 64-bit integers. If we assume that they are incremented 1000 times per second, which is a lot, then doing this continuously for one year requires `ceil(log_2(365 * 24 * 60 * 60 * 1000)) = 35` bits. That leaves 28 bits to spare, so that should give you about 2^28 years before running into problems. That's a long time. :-)
133133

134134
To play with this ring buffer, copy the code to a playground and do the following to mimic the example above:
135135

0 commit comments

Comments
 (0)