| 1 | /* nsp_seq.h 1.3 82/10/09 */ |
| 2 | |
| 3 | /* |
| 4 | * NSP sequence numbers are 12 bit integers operated |
| 5 | * on with modular arithmetic. These macros can be |
| 6 | * used to compare and perform arithmetic on such integers. |
| 7 | */ |
| 8 | #define MAXSEQ (1<<12) |
| 9 | #define SEQMASK (MAXSEQ-1) |
| 10 | |
| 11 | #define SEQ_LSS(a, b) (nsp_seqcmp(a, b) < 0) |
| 12 | #define SEQ_LEQ(a, b) (nsp_seqcmp(a, b) <= 0) |
| 13 | #define SEQ_GTR(a, b) (nsp_seqcmp(a, b) > 0) |
| 14 | #define SEQ_GEQ(a, b) (nsp_seqcmp(a, b) >= 0) |
| 15 | |
| 16 | #define SEQ_ADD(a, b) (((a) + (b)) & SEQMASK) |
| 17 | #define SEQ_SUB(a, b) (((a) - (b)) & SEQMASK) |