summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2003-05-20 01:53:01 +0000
committerpixel <pixel>2003-05-20 01:53:01 +0000
commit5aa0b4422b5a323303c1ec3c4f5fc37a8bf62cd0 (patch)
tree18ef856ccaa662885cf4f43ef5097c6deb694941
parent90eccccfb114ff5a4bcd28482d80dfb01f677466 (diff)
Added ABS
-rw-r--r--include/generic.h8
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