bams1 / support-tools

Automatically exported from code.google.com/p/support-tools
Apache License 2.0
0 stars 0 forks source link

problem with function peektail in circular.c in project logomatic-kwan #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using function peektail
2.
3.

What is the expected output? What do you see instead?

Thought it might help someone else...

Output is ok until int pos reaches the circular buffer size, then it returns 
random characters.

Below is the corrected function:

char peekTail(circular* buf, int pos) {
  pos+=buf->tail;
  pos&=0x3FF;
  return buf->buf[pos%CIRCULAR_BUFFER_SIZE];
}

Original issue reported on code.google.com by chrismn...@gmail.com on 20 Sep 2015 at 3:39

GoogleCodeExporter commented 8 years ago

Original comment by chrsm...@google.com on 13 Nov 2015 at 4:22