--- rxvt-unicode/src/rxvtutil.h 2006/01/30 16:12:58 1.24 +++ rxvt-unicode/src/rxvtutil.h 2006/06/23 14:31:38 1.27 @@ -4,6 +4,8 @@ #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 @@ -56,12 +58,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