1
/***************************************************************************/
5
/* Arithmetic computations (specification). */
7
/* Copyright 1996-2001, 2002, 2003 by */
8
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
10
/* This file is part of the FreeType project, and may only be used, */
11
/* modified, and distributed under the terms of the FreeType project */
12
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13
/* this file you indicate that you have read the license and */
14
/* understand and accept it fully. */
16
/***************************************************************************/
24
#include FT_FREETYPE_H
31
FT_SqrtFixed( FT_Int32 x );
34
#define SQRT_32( x ) FT_Sqrt32( x )
37
/*************************************************************************/
43
/* Computes the square root of an Int32 integer (which will be */
44
/* handled as an unsigned long value). */
47
/* x :: The value to compute the root for. */
50
/* The result of `sqrt(x)'. */
53
FT_Sqrt32( FT_Int32 x );
56
/*************************************************************************/
58
/* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
60
/*************************************************************************/
63
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
65
/*************************************************************************/
68
/* FT_MulDiv_No_Round */
71
/* A very simple function used to perform the computation `(a*b)/c' */
72
/* (without rounding) with maximal accuracy (it uses a 64-bit */
73
/* intermediate integer whenever necessary). */
75
/* This function isn't necessarily as fast as some processor specific */
76
/* operations, but is at least completely portable. */
79
/* a :: The first multiplier. */
80
/* b :: The second multiplier. */
81
/* c :: The divisor. */
84
/* The result of `(a*b)/c'. This function never traps when trying to */
85
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
86
/* on the signs of `a' and `b'. */
89
FT_MulDiv_No_Round( FT_Long a,
93
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
96
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
97
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
98
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
99
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
100
#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
102
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
103
: ( -( ( 32 - (x) ) & -64 ) ) )
108
#endif /* __FTCALC_H__ */