diff options
Diffstat (limited to 'include/generic.h')
-rw-r--r-- | include/generic.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/generic.h b/include/generic.h index 1ec1f29..66772b1 100644 --- a/include/generic.h +++ b/include/generic.h @@ -105,6 +105,14 @@ inline void SWAP(T & a, T & b) { } #endif +#ifndef ABS +template<class T> +inline T ABS(T x) { + T ox = -x; + return x > 0 ? x : ox; +} +#endif + #else // cplusplus #ifndef MAX |