Add and apply WITHIN macro
This commit is contained in:
@ -75,7 +75,8 @@
|
||||
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
|
||||
#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
|
||||
|
||||
#define NUMERIC(a) ((a) >= '0' && '9' >= (a))
|
||||
#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H))
|
||||
#define NUMERIC(a) WITHIN(a, '0', '9')
|
||||
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-')
|
||||
#define COUNT(a) (sizeof(a)/sizeof(*a))
|
||||
#define ZERO(a) memset(a,0,sizeof(a))
|
||||
@ -133,7 +134,7 @@
|
||||
#define MAX4(a, b, c, d) max(max(a, b), max(c, d))
|
||||
|
||||
#define UNEAR_ZERO(x) ((x) < 0.000001)
|
||||
#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)
|
||||
#define NEAR_ZERO(x) WITHIN(x, -0.000001, 0.000001)
|
||||
#define NEAR(x,y) NEAR_ZERO((x)-(y))
|
||||
|
||||
#define RECIPROCAL(x) (NEAR_ZERO(x) ? 0.0 : 1.0 / (x))
|
||||
|
Reference in New Issue
Block a user