Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1.  
  2. double myList[100];
  3. int head, tail ;
  4. // Do not initialize inputs!
  5. void Init(void)
  6. {
  7. head = 0;
  8. tail = 0;
  9. }
  10.  
  11. void Exec(void)
  12. {
  13. if(*v->En == 1){
  14. myList[tail] = *v->In;
  15. //tail = (tail+1)% v->Count;
  16. v->Out = myList[tail] - myList[head] ;
  17. v->head = head;
  18. v->tail = tail;
  19.  
  20. if(tail + 1 >= v->Count) tail = 0; else tail++;
  21. if(tail == head)
  22. if(head+1 >= v->Count) head = 0; else head++;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement