diff options
Diffstat (limited to 'freetype/include/internal/ftobjs.h')
-rw-r--r-- | freetype/include/internal/ftobjs.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/freetype/include/internal/ftobjs.h b/freetype/include/internal/ftobjs.h index 92d2cb1cc..af5faf4a3 100644 --- a/freetype/include/internal/ftobjs.h +++ b/freetype/include/internal/ftobjs.h @@ -72,6 +72,16 @@ FT_BEGIN_HEADER #define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) + /* + * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' + * algorithm. We use alpha = 1, beta = 3/8, giving us results with a + * largest error less than 7% compared to the exact value. + */ +#define FT_HYPOT( x, y ) \ + ( x = FT_ABS( x ), \ + y = FT_ABS( y ), \ + x > y ? x + ( 3 * y >> 3 ) \ + : y + ( 3 * x >> 3 ) ) #define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) #define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n ) @@ -83,14 +93,6 @@ FT_BEGIN_HEADER /* - * Return the highest power of 2 that is <= value; this correspond to - * the highest bit in a given 32-bit value. - */ - FT_BASE( FT_UInt32 ) - ft_highpow2( FT_UInt32 value ); - - - /* * character classification functions -- since these are used to parse * font files, we must not use those in <ctypes.h> which are * locale-dependent |