Files
2013-10-13 17:37:28 +02:00

31 lines
725 B
C

#ifndef UC_SEQ_H_
#define UC_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