31 lines
719 B
C
31 lines
719 B
C
#ifndef SEQ_H_
|
|
#define SEQ_H_
|
|
#include <stdint.h>
|
|
|
|
// 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 greather than b, taking care of wrap arounds
|
|
static inline int uc_seq_gt(uint32_t a, uint32_t 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;
|
|
}
|
|
|
|
|
|
#endif
|