sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
ftmisc.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * ftmisc.h
4 *
5 * Miscellaneous macros for stand-alone rasterizer (specification
6 * only).
7 *
8 * Copyright (C) 2005-2025 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
31#ifndef FTMISC_H_
32#define FTMISC_H_
33
34
35 /* memset */
36#include FT_CONFIG_STANDARD_LIBRARY_H
37
38#define FT_BEGIN_HEADER
39#define FT_END_HEADER
40
41#define FT_LOCAL_DEF( x ) static x
42
43
44 /* from include/freetype/fttypes.h */
45
46 typedef unsigned char FT_Byte;
47 typedef signed int FT_Int;
48 typedef unsigned int FT_UInt;
49 typedef signed long FT_Long;
50 typedef unsigned long FT_ULong;
51 typedef signed long FT_F26Dot6;
52 typedef int FT_Error;
53
54
55#define FT_STATIC_BYTE_CAST( type, var ) (type)(FT_Byte)(var)
56
57
58 /* from include/freetype/ftsystem.h */
59
60 typedef struct FT_MemoryRec_* FT_Memory;
61
62 typedef void* (*FT_Alloc_Func)( FT_Memory memory,
63 long size );
64
65 typedef void (*FT_Free_Func)( FT_Memory memory,
66 void* block );
67
68 typedef void* (*FT_Realloc_Func)( FT_Memory memory,
69 long cur_size,
70 long new_size,
71 void* block );
72
73 typedef struct FT_MemoryRec_
74 {
75 void* user;
76
77 FT_Alloc_Func alloc;
78 FT_Free_Func free;
79 FT_Realloc_Func realloc;
80
81 } FT_MemoryRec;
82
83
84 /* from src/ftcalc.c */
85
86#if ( defined _WIN32 || defined _WIN64 )
87
88 typedef __int64 FT_Int64;
89
90#else
91
92#include "inttypes.h"
93
94 typedef int64_t FT_Int64;
95
96#endif
97
98
99 static FT_Long
100 FT_MulDiv_No_Round( FT_Long a,
101 FT_Long b,
102 FT_Long c )
103 {
104 FT_Int s;
105 FT_Long d;
106
107
108 s = 1;
109 if ( a < 0 ) { a = -a; s = -1; }
110 if ( b < 0 ) { b = -b; s = -s; }
111 if ( c < 0 ) { c = -c; s = -s; }
112
113 d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
114 : 0x7FFFFFFFL );
115
116 return ( s > 0 ) ? d : -d;
117 }
118
119#endif /* FTMISC_H_ */
120
121
122/* END */