00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __FTMISC_H__
00028 #define __FTMISC_H__
00029
00030
00031 #include FT_CONFIG_STANDARD_LIBRARY_H
00032
00033 #define FT_BEGIN_HEADER
00034 #define FT_END_HEADER
00035
00036 #define FT_LOCAL_DEF( x ) static x
00037
00038
00039
00040 typedef unsigned char FT_Byte;
00041 typedef signed int FT_Int;
00042 typedef unsigned int FT_UInt;
00043 typedef signed long FT_Long;
00044 typedef unsigned long FT_ULong;
00045 typedef signed long FT_F26Dot6;
00046 typedef int FT_Error;
00047
00048 #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
00049 ( ( (FT_ULong)_x1 << 24 ) | \
00050 ( (FT_ULong)_x2 << 16 ) | \
00051 ( (FT_ULong)_x3 << 8 ) | \
00052 (FT_ULong)_x4 )
00053
00054
00055
00056
00057 typedef struct FT_MemoryRec_* FT_Memory;
00058
00059 typedef void* (*FT_Alloc_Func)( FT_Memory memory,
00060 long size );
00061
00062 typedef void (*FT_Free_Func)( FT_Memory memory,
00063 void* block );
00064
00065 typedef void* (*FT_Realloc_Func)( FT_Memory memory,
00066 long cur_size,
00067 long new_size,
00068 void* block );
00069
00070 typedef struct FT_MemoryRec_
00071 {
00072 void* user;
00073
00074 FT_Alloc_Func alloc;
00075 FT_Free_Func free;
00076 FT_Realloc_Func realloc;
00077
00078 } FT_MemoryRec;
00079
00080
00081
00082 #include <inttypes.h>
00083
00084 typedef int64_t FT_Int64;
00085
00086 static FT_Long
00087 FT_MulDiv( FT_Long a,
00088 FT_Long b,
00089 FT_Long c )
00090 {
00091 FT_Int s;
00092 FT_Long d;
00093
00094
00095 s = 1;
00096 if ( a < 0 ) { a = -a; s = -1; }
00097 if ( b < 0 ) { b = -b; s = -s; }
00098 if ( c < 0 ) { c = -c; s = -s; }
00099
00100 d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
00101 : 0x7FFFFFFFL );
00102
00103 return ( s > 0 ) ? d : -d;
00104 }
00105
00106 #endif
00107
00108
00109