Drivers for the MNT ZZ9000 graphics and ARM coprocessor card for classic Amigas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
2.2 KiB

  1. /*
  2. macros.h
  3. (C) 2018 Henryk Richter <henryk.richter@gmx.net>
  4. useful macros
  5. */
  6. #ifndef _INC_MACROS_H
  7. #define _INC_MACROS_H
  8. #define GetHead(l) (void *)(((struct List *)l)->lh_Head->ln_Succ \
  9. ? ((struct List *)l)->lh_Head \
  10. : (struct Node *)0)
  11. #define GetTail(l) (void *)(((struct List *)l)->lh_TailPred->ln_Pred \
  12. ? ((struct List *)l)->lh_TailPred \
  13. : (struct Node *)0)
  14. #define GetSucc(n) (void *)(((struct Node *)n)->ln_Succ->ln_Succ \
  15. ? ((struct Node *)n)->ln_Succ \
  16. : (struct Node *)0)
  17. #define GetPred(n) (void *)(((struct Node *)n)->ln_Pred->ln_Pred \
  18. ? ((struct Node *)n)->ln_Pred \
  19. : (struct Node *)0)
  20. #define REMOVE(n) ((void)(\
  21. ((struct Node *)n)->ln_Pred->ln_Succ = ((struct Node *)n)->ln_Succ,\
  22. ((struct Node *)n)->ln_Succ->ln_Pred = ((struct Node *)n)->ln_Pred ))
  23. #define ADDHEAD(l,n) ((void)(\
  24. ((struct Node *)n)->ln_Succ = ((struct List *)l)->lh_Head, \
  25. ((struct Node *)n)->ln_Pred = (struct Node *)&((struct List *)l)->lh_Head, \
  26. ((struct List *)l)->lh_Head->ln_Pred = ((struct Node *)n), \
  27. ((struct List *)l)->lh_Head = ((struct Node *)n)))
  28. #define ADDTAIL(l,n) ((void)(\
  29. ((struct Node *)n)->ln_Succ = (struct Node *)&((struct List *)l)->lh_Tail, \
  30. ((struct Node *)n)->ln_Pred = ((struct List *)l)->lh_TailPred, \
  31. ((struct List *)l)->lh_TailPred->ln_Succ = ((struct Node *)n), \
  32. ((struct List *)l)->lh_TailPred = ((struct Node *)n) ))
  33. #define NEWLIST(l) (((struct List *)l)->lh_TailPred = (struct Node *)(l), \
  34. ((struct List *)l)->lh_Tail = 0, \
  35. ((struct List *)l)->lh_Head = (struct Node *)&(((struct List *)l)->lh_Tail))
  36. #define min(_a_,_b_) ( (_a_) > (_b_) ) ? _b_ : _a_
  37. #define max(_a_,_b_) ( (_a_) < (_b_) ) ? _b_ : _a_
  38. #define BOUNDS(_val_,_min_,_max_) ( (_val_) < (_min_) ) ? _min_ : ( (_val_) > (_max_) ) ? _max_ : _val_
  39. #endif /* _INC_MACROS_H */