Missed from previus commit
This commit is contained in:
+17
-8
@@ -2,19 +2,28 @@
|
||||
#define SEQ_H_
|
||||
#include <stdint.h>
|
||||
|
||||
// Check if a is before b, taking care of wrap arounds
|
||||
static inline int seq_before(uint32_t a, uint32_t b)
|
||||
// Check if a is less than b, taking care of wrap arounds
|
||||
static inline int uc_seq_lt(uint32_t a, uint32_t b)
|
||||
{
|
||||
return (int32_t)(a - b) < 0;
|
||||
}
|
||||
|
||||
// check if a is before b, taking care of wrap arounds
|
||||
#define seq_after(a, b) before(b, a)
|
||||
|
||||
//check if a is between b or c
|
||||
static inline int seqbetween(uint32_t a, uint32_t b, uint32_t c)
|
||||
// check if a is greather than b, taking care of wrap arounds
|
||||
static inline int uc_seq_gt(uint32_t a, uint32_t b)
|
||||
{
|
||||
return c - b >= a - b;
|
||||
return (int32_t)(a - b) > 0;
|
||||
}
|
||||
//
|
||||
// Check if a is less than or equal to b, taking care of wrap arounds
|
||||
static inline int uc_seq_leq(uint32_t a, uint32_t b)
|
||||
{
|
||||
return (int32_t)(a - b) <= 0;
|
||||
}
|
||||
|
||||
// check if a is greather than or equal b, taking care of wrap arounds
|
||||
static inline int uc_seq_geq(uint32_t a, uint32_t b)
|
||||
{
|
||||
return (int32_t)(a - b) >= 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user