c,c
Never
#include <stdio.h> #include <stdint.h> //#include <avr/io.h> #define RINGZ 16 uint8_t ring[RINGZ]; uint8_t head, tail; uint8_t ring_push(uint8_t c) { if( (head==tail) || // empty ((head+1)&RINGZ)!=tail ) // chasing tail { ring[head]= c; head++; // advance head head&= RINGZ; // wrap as required printf("push %hhd\thead=%hhd\n", c, head ); return c; } printf("BAD push: h(%hhd) t(%hhd)\n", head, tail); return 0xFF-c; // this would be "FULL" } uint8_t ring_pull() { if( tail!=head ) // !empty { uint8_t c; c= ring[tail]; tail++; tail&= RINGZ; printf("pull %hhd\thead=%hhd\n", c, tail ); return c; } printf("BAD pull: h(%hhd) t(%hhd)\n", head, tail); return -1; } #if 0 ISR(USART_RXC_vect) { // Read and echo to host... UDR0= ring_push(UDR0); } #endif int main() { int i, j; for(int i=0; i<3; i++) { for(j=i*10; j<(i*10)+10; j++) printf("%d:\t",j), ring_push(j); for(j=0; j<6; j++) printf("%d:\t",j), ring_pull(); } return 0; }
Raw Text
-
Adult Telegram Channels
12 min ago
-
The Ugly Truth About FITSPRESSO
20 min ago
-
Nothing pushes the blonde and brunette milfs with fake boobs over the edge like Outdoor group sex
25 min ago
-
https://www.facebook.com/MakersCBDGummies/
26 min ago
-
https://www.facebook.com/TheSlimGuard/
27 min ago
-
Sexy hot mature MILF Mrs. Claus try's anal for the first time and gets put on The Naughty List
55 min ago
-
iaaee
57 min ago
-
mokhaseum
1 hour ago
-
Adult Telegram Channels
1 hour ago
-
No Deposit Bonus
1 hour ago