diff options
author | pixel <pixel> | 2003-05-20 01:53:01 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-05-20 01:53:01 +0000 |
commit | 5aa0b4422b5a323303c1ec3c4f5fc37a8bf62cd0 (patch) | |
tree | 18ef856ccaa662885cf4f43ef5097c6deb694941 | |
parent | 90eccccfb114ff5a4bcd28482d80dfb01f677466 (diff) |
Added ABS
-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 |