From 5aa0b4422b5a323303c1ec3c4f5fc37a8bf62cd0 Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 20 May 2003 01:53:01 +0000 Subject: Added ABS --- include/generic.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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 +inline T ABS(T x) { + T ox = -x; + return x > 0 ? x : ox; +} +#endif + #else // cplusplus #ifndef MAX -- cgit v1.2.3