mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-10 00:52:11 +01:00
Added ABS, GSN, MIN, MAX, CLAMP macros to math.h for convenience.
This commit is contained in:
parent
e28007085c
commit
69a2d2f1b7
@ -215,4 +215,24 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef ABS
|
||||
#define ABS(x) ((x > 0) ? (x) : (-x))
|
||||
#endif
|
||||
|
||||
#ifndef SGN
|
||||
#define SGN(x) ((x > 0) ? (1.0) : (-1.0))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x, y) ((x > y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) ((x < y) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(a, cmin, cmax) ((a < cmin) ? (cmin) : ((a > cmax) ? (cmax) : (a)))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user