--- a/src/Vector.hh Thu Jan 22 04:09:53 2009 +0200
+++ b/src/Vector.hh Thu Jan 22 04:24:26 2009 +0200
@@ -200,16 +200,9 @@
return s << "(" << v.x << ", " << v.y << ")";
}
-// Templates function implementations
-#include <cmath>
-#include <cstdlib>
-
-/**
- * Float/int absolute value
+/*
+ * Vector template method implementation
*/
-template<typename T> static T absType (T value);
-template<> static float absType<float> (float value) { return (float) fabs(value); }
-template<> static long absType<long> (long value) { return labs(value); }
/**
* Direction-normalize the given coordinate against the tangent coordinate.
@@ -218,10 +211,11 @@
* negative, else zero.
*/
template<typename T> static T normalizeCoordinate (T coord, T tangent) {
- if (coord > absType(tangent))
+ // XXX: use hand-crafted abs because GCC 4.3/4.2 static template functions seem to be broken somehow
+ if (coord > (tangent < 0 ? -tangent : tangent))
return 1;
- else if (coord < -absType(tangent))
+ else if (coord < (tangent > 0 ? -tangent : tangent))
return -1;
else