diff --git a/astlpc.c b/astlpc.c index 87a4ccad..64dd9de4 100644 --- a/astlpc.c +++ b/astlpc.c @@ -23,6 +23,7 @@ #include "libmctp-log.h" #include "libmctp-astlpc.h" #include "container_of.h" +#include "range.h" #ifdef MCTP_HAVE_FILEIO @@ -129,20 +130,6 @@ static const uint32_t control_size = 0x100; #define KCS_STATUS_IBF 0x02 #define KCS_STATUS_OBF 0x01 -#define MIN(a, b) \ - ({ \ - typeof(a) _a = a; \ - typeof(b) _b = b; \ - _a < _b ? _a : _b; \ - }) - -#define MAX(a, b) \ - ({ \ - typeof(a) _a = a; \ - typeof(b) _b = b; \ - _a > _b ? _a : _b; \ - }) - static inline int mctp_astlpc_kcs_write(struct mctp_binding_astlpc *astlpc, enum mctp_binding_astlpc_kcs_reg reg, uint8_t val) diff --git a/range.h b/range.h new file mode 100644 index 00000000..6c960158 --- /dev/null +++ b/range.h @@ -0,0 +1,18 @@ +#ifndef _RANGE_H +#define _RANGE_H + +#define MIN(a, b) \ + ({ \ + typeof(a) _a = a; \ + typeof(b) _b = b; \ + _a < _b ? _a : _b; \ + }) + +#define MAX(a, b) \ + ({ \ + typeof(a) _a = a; \ + typeof(b) _b = b; \ + _a > _b ? _a : _b; \ + }) + +#endif