Dave Tweed wrote: > Sergio wrote: > > Ok, further to Dave's asertion that we could use a flag to allow us to > > completely fill the FIFO. I have revised the FIFO code I posted and come > > up with the following (appended to the end of this post). It uses two > > extra counts instead of the one flag proposed by Dave. > > Actually, that gives me an idea. If you simply allow the "head" and "tail" > variables to count to twice the size of the FIFO, then they can perform > both the indexing function and the counting function, with very little > additional overhead, and no added thread-safety issues. Nice. Solves many buffer problems . Regards, -- Walter Banks Byte Craft Limited http://www.bytecraft.com walter@bytecraft.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist