1 /****************************************************************************
5 * Miscellaneous macros for stand-alone rasterizer (specification
8 * Copyright (C) 2005-2020 by
9 * David Turner, Robert Wilhelm, and Werner Lemberg.
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.
20 /****************************************************
22 * This file is *not* portable! You have to adapt
23 * its definitions to your platform.
32 #include FT_CONFIG_STANDARD_LIBRARY_H
34 #define FT_BEGIN_HEADER
37 #define FT_LOCAL_DEF( x ) static x
40 /* from include/freetype/fttypes.h */
42 typedef unsigned char FT_Byte;
43 typedef signed int FT_Int;
44 typedef unsigned int FT_UInt;
45 typedef signed long FT_Long;
46 typedef unsigned long FT_ULong;
47 typedef signed long FT_F26Dot6;
50 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
51 ( ( (FT_ULong)_x1 << 24 ) | \
52 ( (FT_ULong)_x2 << 16 ) | \
53 ( (FT_ULong)_x3 << 8 ) | \
57 /* from include/freetype/ftsystem.h */
59 typedef struct FT_MemoryRec_* FT_Memory;
61 typedef void* (*FT_Alloc_Func)( FT_Memory memory,
64 typedef void (*FT_Free_Func)( FT_Memory memory,
67 typedef void* (*FT_Realloc_Func)( FT_Memory memory,
72 typedef struct FT_MemoryRec_
78 FT_Realloc_Func realloc;
83 /* from src/ftcalc.c */
85 #if ( defined _WIN32 || defined _WIN64 )
87 typedef __int64 FT_Int64;
93 typedef int64_t FT_Int64;
108 if ( a < 0 ) { a = -a; s = -1; }
109 if ( b < 0 ) { b = -b; s = -s; }
110 if ( c < 0 ) { c = -c; s = -s; }
112 d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
115 return ( s > 0 ) ? d : -d;
120 FT_MulDiv_No_Round( FT_Long a,
129 if ( a < 0 ) { a = -a; s = -1; }
130 if ( b < 0 ) { b = -b; s = -s; }
131 if ( c < 0 ) { c = -c; s = -s; }
133 d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
136 return ( s > 0 ) ? d : -d;
139 #endif /* FTMISC_H_ */