Sync with trunk head (part 1 or 2)
[reactos.git] / lib / 3rdparty / freetype / src / raster / ftmisc.h
1 /***************************************************************************/
2 /* */
3 /* ftmisc.h */
4 /* */
5 /* Miscellaneous macros for stand-alone rasterizer (specification */
6 /* only). */
7 /* */
8 /* Copyright 2005 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* */
11 /* This file is part of the FreeType project, and may only be used */
12 /* modified and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */
16 /* */
17 /***************************************************************************/
18
19
20 /***************************************************/
21 /* */
22 /* This file is *not* portable! You have to adapt */
23 /* its definitions to your platform. */
24 /* */
25 /***************************************************/
26
27 #ifndef __FTMISC_H__
28 #define __FTMISC_H__
29
30 #include <string.h> /* memset */
31
32 #define FT_BEGIN_HEADER
33 #define FT_END_HEADER
34
35 #define FT_LOCAL_DEF( x ) static x
36
37 /* from include/freetype2/fttypes.h */
38
39 typedef unsigned char FT_Byte;
40 typedef signed int FT_Int;
41 typedef unsigned int FT_UInt;
42 typedef signed long FT_Long;
43 typedef unsigned long FT_ULong;
44 typedef signed long FT_F26Dot6;
45 typedef int FT_Error;
46
47 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
48 ( ( (FT_ULong)_x1 << 24 ) | \
49 ( (FT_ULong)_x2 << 16 ) | \
50 ( (FT_ULong)_x3 << 8 ) | \
51 (FT_ULong)_x4 )
52
53
54 /* from src/ftcalc.c */
55
56 #include <inttypes.h>
57
58 typedef int64_t FT_Int64;
59
60 static FT_Long
61 FT_MulDiv( FT_Long a,
62 FT_Long b,
63 FT_Long c )
64 {
65 FT_Int s;
66 FT_Long d;
67
68
69 s = 1;
70 if ( a < 0 ) { a = -a; s = -1; }
71 if ( b < 0 ) { b = -b; s = -s; }
72 if ( c < 0 ) { c = -c; s = -s; }
73
74 d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
75 : 0x7FFFFFFFL );
76
77 return ( s > 0 ) ? d : -d;
78 }
79
80 #endif /* __FTMISC_H__ */
81
82
83 /* END */