0860片山博文MZ ◆T6xkBnTXz7B0
2017/10/15(日) 05:20:33.19ID:3VVV/TO4#define BUFSIZE 255
unsigned char buf[BUFSIZE] = {0};
size_t head = 0, tail = 0;
void push(unsigned char data)
{
assert(head < BUFSIZE);
buffer[head] = data;
++head;
if (head >= BUFSIZE) head = 0;
}
unsigned char pop()
{
unsigned char ret;
assert(tail < BUFSIZE);
ret = buf[tail];
++tail;
if (tail >= BUFSIZE) tail = 0;
return ret;
}