diff --git a/sw/include/std.h b/sw/include/std.h index 3def069a3e..e99084da02 100644 --- a/sw/include/std.h +++ b/sw/include/std.h @@ -86,7 +86,9 @@ typedef uint8_t unit_t; #define Min(x,y) (x < y ? x : y) #define Max(x,y) (x > y ? x : y) +#ifndef ABS #define ABS(val) ((val) < 0 ? -(val) : (val)) +#endif #define Bound(_x, _min, _max) { if (_x > _max) _x = _max; else if (_x < _min) _x = _min; } #define BoundAbs(_x, _max) Bound(_x, -(_max), (_max))