I was just going to go with a 255 byte ring buffer so I could keep the size field in a simple uint8_t, but I though t there has to be a way to eliminate those if it is 255 then zero the pointer tests and of course moving a 256 sized ring buffer using uint8_t pointer (index) variables will do that. The problem there is that to hold "256" items you need ot move to a uint16_t, but I want to optimize it to be as simple as possible. I also thought about only using 255 spaces of the 256 size which solves the pointer reset issue and still would leave you with a uint8_t size variable. I came up with this so far - I've not tested it yet, but no tests to reset pointers, no variable for size at all, and all 256 positions can be used.
//256 byte ringbuffer (no overflow ptr checking, all 256 positions used, no count variable) //clear it ringbuf_ptrin=0; ringbuf_ptrout=0; ringbuf_empty=1; //is it empty? if (ringbuf_empty) return; //remove from it (assumes not empty) AChar=ringbuf_buffer[ringbuf_ptrout]; ringbuf_ptrout++; if (ringbuf_ptrout==ringbuf_ptrin) ringbuf_empty=1; //is it full? if (ringbuf_ptrout==ringbuf_ptrin && !ringbuf_empty) return; //add to it (assumes not full) ringbuf_buffer[ringbuf_ptrin]=AChar; ringbuf_ptrin++; ringbuf_empty=0;