update for HEAD-2003050101
[reactos.git] / lib / freetype / include / freetype / internal / ftcalc.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  ftcalc.h                                                               */
4 /*                                                                         */
5 /*    Arithmetic computations (specification).                             */
6 /*                                                                         */
7 /*  Copyright 1996-2001, 2002 by                                           */
8 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
9 /*                                                                         */
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.                                        */
15 /*                                                                         */
16 /***************************************************************************/
17
18
19 #ifndef __FTCALC_H__
20 #define __FTCALC_H__
21
22
23 #include <ft2build.h>
24 #include FT_FREETYPE_H
25
26
27 FT_BEGIN_HEADER
28
29
30   FT_EXPORT( FT_Int32 )  FT_SqrtFixed( FT_Int32  x );
31
32
33 #define SQRT_32( x )  FT_Sqrt32( x )
34
35
36   /*************************************************************************/
37   /*                                                                       */
38   /* <Function>                                                            */
39   /*    FT_Sqrt32                                                          */
40   /*                                                                       */
41   /* <Description>                                                         */
42   /*    Computes the square root of an Int32 integer (which will be        */
43   /*    handled as an unsigned long value).                                */
44   /*                                                                       */
45   /* <Input>                                                               */
46   /*    x :: The value to compute the root for.                            */
47   /*                                                                       */
48   /* <Return>                                                              */
49   /*    The result of `sqrt(x)'.                                           */
50   /*                                                                       */
51   FT_EXPORT( FT_Int32 )
52   FT_Sqrt32( FT_Int32  x );
53
54
55   /*************************************************************************/
56   /*                                                                       */
57   /* FT_MulDiv() and FT_MulFix() are declared in freetype.h.               */
58   /*                                                                       */
59   /*************************************************************************/
60
61
62 #define INT_TO_F26DOT6( x )    ( (FT_Long)(x) << 6  )
63 #define INT_TO_F2DOT14( x )    ( (FT_Long)(x) << 14 )
64 #define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )
65 #define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )
66 #define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )
67
68 #define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \
69                                         : ( -( ( 32 - (x) ) & -64 ) ) )
70
71
72 FT_END_HEADER
73
74 #endif /* __FTCALC_H__ */
75
76
77 /* END */