# HG changeset patch # User Tero Marttila # Date 1232591066 -7200 # Node ID 567144562978fb62a6e747a4948268c76d506083 # Parent f337a86d144e9133bc9f83349c2cc8ea68fb2074 more compile-fixing, this is GCC 4.3 with a 64-bit libc and it's damn stupid diff -r f337a86d144e -r 567144562978 src/Network/Packet.cc --- a/src/Network/Packet.cc Thu Jan 22 04:09:53 2009 +0200 +++ b/src/Network/Packet.cc Thu Jan 22 04:24:26 2009 +0200 @@ -5,6 +5,7 @@ #include "Packet.hh" #include "Platform.hh" +#include #include // XXX: assumes that sizeof(float32) == sizeof(int32); diff -r f337a86d144e -r 567144562978 src/Vector.hh --- 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 -#include - -/** - * Float/int absolute value +/* + * Vector template method implementation */ -template static T absType (T value); -template<> static float absType (float value) { return (float) fabs(value); } -template<> static long absType (long value) { return labs(value); } /** * Direction-normalize the given coordinate against the tangent coordinate. @@ -218,10 +211,11 @@ * negative, else zero. */ template 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