Fix the RingBuffer implementation
* ReadableCount() previously returned wrong values: for example:
0 1 2 3 4 5 6 7 8 9 N=10
W R
There are 7 readable elements (5,6,7,8,9,0,1), but ReadableCount() previously
returned (r - w) which is 3.
* WritableCount() allowed the buffer to get full even though the RingBuffer API
specified that you should never let the buffer fill up.