--- rxvt-unicode/src/rxvtutil.h 2006/01/30 16:12:58 1.24 +++ rxvt-unicode/src/rxvtutil.h 2007/10/31 09:55:24 1.29 @@ -4,13 +4,14 @@ #include #include +using namespace std; + #define PP_CONCAT_(a, b) a ## b #define PP_CONCAT(a, b) PP_CONCAT_(a, b) #define PP_STRINGIFY_(a) #a #define PP_STRINGIFY(a) PP_STRINGIFY_(a) -// actually, some gcc-3.x versions work, too -#define HAVE_GCC_BUILTINS (__GNUC__ >= 4) +#define HAVE_GCC_BUILTINS (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ == 4)) #ifndef __attribute__ # if __GNUC__ @@ -56,12 +57,14 @@ template static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } +template static inline T squared_diff (T a, T b) { return (a-b)*(a-b); } + // linear interpolation template static inline T lerp (T a, U b, P p) { - return (int(a) * int(p) + int(b) * int(100 - p)) / 100; + return (long(a) * long(100 - p) + long(b) * long(p) + 50) / 100; } // some bit functions, xft fuck me plenty @@ -89,7 +92,7 @@ }; /* simplevec taken (and heavily modified), from: - * + * * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder */