| 1 | /* ftconfig.h. Generated from ftconfig.in by configure. */ |
| 2 | /***************************************************************************/ |
| 3 | /* */ |
| 4 | /* ftconfig.in */ |
| 5 | /* */ |
| 6 | /* UNIX-specific configuration file (specification only). */ |
| 7 | /* */ |
| 8 | /* Copyright 1996-2004, 2006-2009, 2011, 2013 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 header file contains a number of macro definitions that are used */ |
| 23 | /* by the rest of the engine. Most of the macros here are automatically */ |
| 24 | /* determined at compile time, and you should not need to change it to */ |
| 25 | /* port FreeType, except to compile the library with a non-ANSI */ |
| 26 | /* compiler. */ |
| 27 | /* */ |
| 28 | /* Note however that if some specific modifications are needed, we */ |
| 29 | /* advise you to place a modified copy in your build directory. */ |
| 30 | /* */ |
| 31 | /* The build directory is usually `builds/<system>', and contains */ |
| 32 | /* system-specific files that are always included first when building */ |
| 33 | /* the library. */ |
| 34 | /* */ |
| 35 | /*************************************************************************/ |
| 36 | |
| 37 | |
| 38 | #ifndef __FTCONFIG_H__ |
| 39 | #define __FTCONFIG_H__ |
| 40 | |
| 41 | #include <ft2build.h> |
| 42 | #include FT_CONFIG_OPTIONS_H |
| 43 | #include FT_CONFIG_STANDARD_LIBRARY_H |
| 44 | |
| 45 | |
| 46 | FT_BEGIN_HEADER |
| 47 | |
| 48 | |
| 49 | /*************************************************************************/ |
| 50 | /* */ |
| 51 | /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ |
| 52 | /* */ |
| 53 | /* These macros can be toggled to suit a specific system. The current */ |
| 54 | /* ones are defaults used to compile FreeType in an ANSI C environment */ |
| 55 | /* (16bit compilers are also supported). Copy this file to your own */ |
| 56 | /* `builds/<system>' directory, and edit it to port the engine. */ |
| 57 | /* */ |
| 58 | /*************************************************************************/ |
| 59 | |
| 60 | |
| 61 | #define HAVE_UNISTD_H 1 |
| 62 | #define HAVE_FCNTL_H 1 |
| 63 | #define HAVE_STDINT_H 1 |
| 64 | |
| 65 | |
| 66 | /* There are systems (like the Texas Instruments 'C54x) where a `char' */ |
| 67 | /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ |
| 68 | /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ |
| 69 | /* is probably unexpected. */ |
| 70 | /* */ |
| 71 | /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ |
| 72 | /* `char' type. */ |
| 73 | |
| 74 | #ifndef FT_CHAR_BIT |
| 75 | #define FT_CHAR_BIT CHAR_BIT |
| 76 | #endif |
| 77 | |
| 78 | |
| 79 | /* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */ |
| 80 | #ifdef FT_USE_AUTOCONF_SIZEOF_TYPES |
| 81 | |
| 82 | #define SIZEOF_INT 4 |
| 83 | #define SIZEOF_LONG 8 |
| 84 | #define FT_SIZEOF_INT SIZEOF_INT |
| 85 | #define FT_SIZEOF_LONG SIZEOF_LONG |
| 86 | |
| 87 | #else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ |
| 88 | |
| 89 | /* Following cpp computation of the bit length of int and long */ |
| 90 | /* is copied from default include/config/ftconfig.h. */ |
| 91 | /* If any improvement is required for this file, it should be */ |
| 92 | /* applied to the original header file for the builders that */ |
| 93 | /* does not use configure script. */ |
| 94 | |
| 95 | /* The size of an `int' type. */ |
| 96 | #if FT_UINT_MAX == 0xFFFFUL |
| 97 | #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) |
| 98 | #elif FT_UINT_MAX == 0xFFFFFFFFUL |
| 99 | #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) |
| 100 | #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL |
| 101 | #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) |
| 102 | #else |
| 103 | #error "Unsupported size of `int' type!" |
| 104 | #endif |
| 105 | |
| 106 | /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ |
| 107 | /* DM642) is recognized but avoided. */ |
| 108 | #if FT_ULONG_MAX == 0xFFFFFFFFUL |
| 109 | #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
| 110 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL |
| 111 | #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
| 112 | #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL |
| 113 | #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) |
| 114 | #else |
| 115 | #error "Unsupported size of `long' type!" |
| 116 | #endif |
| 117 | |
| 118 | #endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ |
| 119 | |
| 120 | |
| 121 | /* FT_UNUSED is a macro used to indicate that a given parameter is not */ |
| 122 | /* used -- this is only used to get rid of unpleasant compiler warnings */ |
| 123 | #ifndef FT_UNUSED |
| 124 | #define FT_UNUSED( arg ) ( (arg) = (arg) ) |
| 125 | #endif |
| 126 | |
| 127 | |
| 128 | /*************************************************************************/ |
| 129 | /* */ |
| 130 | /* AUTOMATIC CONFIGURATION MACROS */ |
| 131 | /* */ |
| 132 | /* These macros are computed from the ones defined above. Don't touch */ |
| 133 | /* their definition, unless you know precisely what you are doing. No */ |
| 134 | /* porter should need to mess with them. */ |
| 135 | /* */ |
| 136 | /*************************************************************************/ |
| 137 | |
| 138 | |
| 139 | /*************************************************************************/ |
| 140 | /* */ |
| 141 | /* Mac support */ |
| 142 | /* */ |
| 143 | /* This is the only necessary change, so it is defined here instead */ |
| 144 | /* providing a new configuration file. */ |
| 145 | /* */ |
| 146 | #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) |
| 147 | /* no Carbon frameworks for 64bit 10.4.x */ |
| 148 | /* AvailabilityMacros.h is available since Mac OS X 10.2, */ |
| 149 | /* so guess the system version by maximum errno before inclusion */ |
| 150 | #include <errno.h> |
| 151 | #ifdef ECANCELED /* defined since 10.2 */ |
| 152 | #include "AvailabilityMacros.h" |
| 153 | #endif |
| 154 | #if defined( __LP64__ ) && \ |
| 155 | ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) |
| 156 | #undef FT_MACINTOSH |
| 157 | #endif |
| 158 | |
| 159 | #elif defined( __SC__ ) || defined( __MRC__ ) |
| 160 | /* Classic MacOS compilers */ |
| 161 | #include "ConditionalMacros.h" |
| 162 | #if TARGET_OS_MAC |
| 163 | #define FT_MACINTOSH 1 |
| 164 | #endif |
| 165 | |
| 166 | #endif |
| 167 | |
| 168 | |
| 169 | /* Fix compiler warning with sgi compiler */ |
| 170 | #if defined( __sgi ) && !defined( __GNUC__ ) |
| 171 | #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) |
| 172 | #pragma set woff 3505 |
| 173 | #endif |
| 174 | #endif |
| 175 | |
| 176 | |
| 177 | /*************************************************************************/ |
| 178 | /* */ |
| 179 | /* <Section> */ |
| 180 | /* basic_types */ |
| 181 | /* */ |
| 182 | /*************************************************************************/ |
| 183 | |
| 184 | |
| 185 | /*************************************************************************/ |
| 186 | /* */ |
| 187 | /* <Type> */ |
| 188 | /* FT_Int16 */ |
| 189 | /* */ |
| 190 | /* <Description> */ |
| 191 | /* A typedef for a 16bit signed integer type. */ |
| 192 | /* */ |
| 193 | typedef signed short FT_Int16; |
| 194 | |
| 195 | |
| 196 | /*************************************************************************/ |
| 197 | /* */ |
| 198 | /* <Type> */ |
| 199 | /* FT_UInt16 */ |
| 200 | /* */ |
| 201 | /* <Description> */ |
| 202 | /* A typedef for a 16bit unsigned integer type. */ |
| 203 | /* */ |
| 204 | typedef unsigned short FT_UInt16; |
| 205 | |
| 206 | /* */ |
| 207 | |
| 208 | |
| 209 | /* this #if 0 ... #endif clause is for documentation purposes */ |
| 210 | #if 0 |
| 211 | |
| 212 | /*************************************************************************/ |
| 213 | /* */ |
| 214 | /* <Type> */ |
| 215 | /* FT_Int32 */ |
| 216 | /* */ |
| 217 | /* <Description> */ |
| 218 | /* A typedef for a 32bit signed integer type. The size depends on */ |
| 219 | /* the configuration. */ |
| 220 | /* */ |
| 221 | typedef signed XXX FT_Int32; |
| 222 | |
| 223 | |
| 224 | /*************************************************************************/ |
| 225 | /* */ |
| 226 | /* <Type> */ |
| 227 | /* FT_UInt32 */ |
| 228 | /* */ |
| 229 | /* A typedef for a 32bit unsigned integer type. The size depends on */ |
| 230 | /* the configuration. */ |
| 231 | /* */ |
| 232 | typedef unsigned XXX FT_UInt32; |
| 233 | |
| 234 | |
| 235 | /*************************************************************************/ |
| 236 | /* */ |
| 237 | /* <Type> */ |
| 238 | /* FT_Int64 */ |
| 239 | /* */ |
| 240 | /* A typedef for a 64bit signed integer type. The size depends on */ |
| 241 | /* the configuration. Only defined if there is real 64bit support; */ |
| 242 | /* otherwise, it gets emulated with a structure (if necessary). */ |
| 243 | /* */ |
| 244 | typedef signed XXX FT_Int64; |
| 245 | |
| 246 | |
| 247 | /*************************************************************************/ |
| 248 | /* */ |
| 249 | /* <Type> */ |
| 250 | /* FT_UInt64 */ |
| 251 | /* */ |
| 252 | /* A typedef for a 64bit unsigned integer type. The size depends on */ |
| 253 | /* the configuration. Only defined if there is real 64bit support; */ |
| 254 | /* otherwise, it gets emulated with a structure (if necessary). */ |
| 255 | /* */ |
| 256 | typedef unsigned XXX FT_UInt64; |
| 257 | |
| 258 | /* */ |
| 259 | |
| 260 | #endif |
| 261 | |
| 262 | #if FT_SIZEOF_INT == 4 |
| 263 | |
| 264 | typedef signed int FT_Int32; |
| 265 | typedef unsigned int FT_UInt32; |
| 266 | |
| 267 | #elif FT_SIZEOF_LONG == 4 |
| 268 | |
| 269 | typedef signed long FT_Int32; |
| 270 | typedef unsigned long FT_UInt32; |
| 271 | |
| 272 | #else |
| 273 | #error "no 32bit type found -- please check your configuration files" |
| 274 | #endif |
| 275 | |
| 276 | |
| 277 | /* look up an integer type that is at least 32 bits */ |
| 278 | #if FT_SIZEOF_INT >= 4 |
| 279 | |
| 280 | typedef int FT_Fast; |
| 281 | typedef unsigned int FT_UFast; |
| 282 | |
| 283 | #elif FT_SIZEOF_LONG >= 4 |
| 284 | |
| 285 | typedef long FT_Fast; |
| 286 | typedef unsigned long FT_UFast; |
| 287 | |
| 288 | #endif |
| 289 | |
| 290 | |
| 291 | /* determine whether we have a 64-bit int type for platforms without */ |
| 292 | /* Autoconf */ |
| 293 | #if FT_SIZEOF_LONG == 8 |
| 294 | |
| 295 | /* FT_LONG64 must be defined if a 64-bit type is available */ |
| 296 | #define FT_LONG64 |
| 297 | #define FT_INT64 long |
| 298 | #define FT_UINT64 unsigned long |
| 299 | |
| 300 | #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
| 301 | |
| 302 | /* this compiler provides the __int64 type */ |
| 303 | #define FT_LONG64 |
| 304 | #define FT_INT64 __int64 |
| 305 | #define FT_UINT64 unsigned __int64 |
| 306 | |
| 307 | #elif defined( __BORLANDC__ ) /* Borland C++ */ |
| 308 | |
| 309 | /* XXXX: We should probably check the value of __BORLANDC__ in order */ |
| 310 | /* to test the compiler version. */ |
| 311 | |
| 312 | /* this compiler provides the __int64 type */ |
| 313 | #define FT_LONG64 |
| 314 | #define FT_INT64 __int64 |
| 315 | #define FT_UINT64 unsigned __int64 |
| 316 | |
| 317 | #elif defined( __WATCOMC__ ) /* Watcom C++ */ |
| 318 | |
| 319 | /* Watcom doesn't provide 64-bit data types */ |
| 320 | |
| 321 | #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ |
| 322 | |
| 323 | #define FT_LONG64 |
| 324 | #define FT_INT64 long long int |
| 325 | #define FT_UINT64 unsigned long long int |
| 326 | |
| 327 | #elif defined( __GNUC__ ) |
| 328 | |
| 329 | /* GCC provides the `long long' type */ |
| 330 | #define FT_LONG64 |
| 331 | #define FT_INT64 long long int |
| 332 | #define FT_UINT64 unsigned long long int |
| 333 | |
| 334 | #endif /* FT_SIZEOF_LONG == 8 */ |
| 335 | |
| 336 | |
| 337 | /*************************************************************************/ |
| 338 | /* */ |
| 339 | /* A 64-bit data type will create compilation problems if you compile */ |
| 340 | /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ |
| 341 | /* is defined. You can however ignore this rule by defining the */ |
| 342 | /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ |
| 343 | /* */ |
| 344 | #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
| 345 | |
| 346 | #ifdef __STDC__ |
| 347 | |
| 348 | /* Undefine the 64-bit macros in strict ANSI compilation mode. */ |
| 349 | /* Since `#undef' doesn't survive in configuration header files */ |
| 350 | /* we use the postprocessing facility of AC_CONFIG_HEADERS to */ |
| 351 | /* replace the leading `/' with `#'. */ |
| 352 | #undef FT_LONG64 |
| 353 | #undef FT_INT64 |
| 354 | |
| 355 | #endif /* __STDC__ */ |
| 356 | |
| 357 | #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ |
| 358 | |
| 359 | #ifdef FT_LONG64 |
| 360 | typedef FT_INT64 FT_Int64; |
| 361 | typedef FT_UINT64 FT_UInt64; |
| 362 | #endif |
| 363 | |
| 364 | |
| 365 | #define FT_BEGIN_STMNT do { |
| 366 | #define FT_END_STMNT } while ( 0 ) |
| 367 | #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
| 368 | |
| 369 | |
| 370 | #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER |
| 371 | /* Provide assembler fragments for performance-critical functions. */ |
| 372 | /* These must be defined `static __inline__' with GCC. */ |
| 373 | |
| 374 | #if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ |
| 375 | |
| 376 | #define FT_MULFIX_ASSEMBLER FT_MulFix_arm |
| 377 | |
| 378 | /* documentation is in freetype.h */ |
| 379 | |
| 380 | static __inline FT_Int32 |
| 381 | FT_MulFix_arm( FT_Int32 a, |
| 382 | FT_Int32 b ) |
| 383 | { |
| 384 | register FT_Int32 t, t2; |
| 385 | |
| 386 | |
| 387 | __asm |
| 388 | { |
| 389 | smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ |
| 390 | mov a, t, asr #31 /* a = (hi >> 31) */ |
| 391 | add a, a, #0x8000 /* a += 0x8000 */ |
| 392 | adds t2, t2, a /* t2 += a */ |
| 393 | adc t, t, #0 /* t += carry */ |
| 394 | mov a, t2, lsr #16 /* a = t2 >> 16 */ |
| 395 | orr a, a, t, lsl #16 /* a |= t << 16 */ |
| 396 | } |
| 397 | return a; |
| 398 | } |
| 399 | |
| 400 | #endif /* __CC_ARM || __ARMCC__ */ |
| 401 | |
| 402 | |
| 403 | #ifdef __GNUC__ |
| 404 | |
| 405 | #if defined( __arm__ ) && \ |
| 406 | ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \ |
| 407 | !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) |
| 408 | |
| 409 | #define FT_MULFIX_ASSEMBLER FT_MulFix_arm |
| 410 | |
| 411 | /* documentation is in freetype.h */ |
| 412 | |
| 413 | static __inline__ FT_Int32 |
| 414 | FT_MulFix_arm( FT_Int32 a, |
| 415 | FT_Int32 b ) |
| 416 | { |
| 417 | register FT_Int32 t, t2; |
| 418 | |
| 419 | |
| 420 | __asm__ __volatile__ ( |
| 421 | "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ |
| 422 | "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ |
| 423 | #ifdef __clang__ |
| 424 | "add.w %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ |
| 425 | #else |
| 426 | "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ |
| 427 | #endif |
| 428 | "adds %1, %1, %0\n\t" /* %1 += %0 */ |
| 429 | "adc %2, %2, #0\n\t" /* %2 += carry */ |
| 430 | "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ |
| 431 | "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ |
| 432 | : "=r" (a), "=&r" (t2), "=&r" (t) |
| 433 | : "r" (a), "r" (b) |
| 434 | : "cc" ); |
| 435 | return a; |
| 436 | } |
| 437 | |
| 438 | #endif /* __arm__ && */ |
| 439 | /* ( __thumb2__ || !__thumb__ ) && */ |
| 440 | /* !( __CC_ARM || __ARMCC__ ) */ |
| 441 | |
| 442 | |
| 443 | #if defined( __i386__ ) |
| 444 | |
| 445 | #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 |
| 446 | |
| 447 | /* documentation is in freetype.h */ |
| 448 | |
| 449 | static __inline__ FT_Int32 |
| 450 | FT_MulFix_i386( FT_Int32 a, |
| 451 | FT_Int32 b ) |
| 452 | { |
| 453 | register FT_Int32 result; |
| 454 | |
| 455 | |
| 456 | __asm__ __volatile__ ( |
| 457 | "imul %%edx\n" |
| 458 | "movl %%edx, %%ecx\n" |
| 459 | "sarl $31, %%ecx\n" |
| 460 | "addl $0x8000, %%ecx\n" |
| 461 | "addl %%ecx, %%eax\n" |
| 462 | "adcl $0, %%edx\n" |
| 463 | "shrl $16, %%eax\n" |
| 464 | "shll $16, %%edx\n" |
| 465 | "addl %%edx, %%eax\n" |
| 466 | : "=a" (result), "=d" (b) |
| 467 | : "a" (a), "d" (b) |
| 468 | : "%ecx" , "cc" ); |
| 469 | return result; |
| 470 | } |
| 471 | |
| 472 | #endif /* i386 */ |
| 473 | |
| 474 | #endif /* __GNUC__ */ |
| 475 | |
| 476 | |
| 477 | #ifdef _MSC_VER /* Visual C++ */ |
| 478 | |
| 479 | #ifdef _M_IX86 |
| 480 | |
| 481 | #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 |
| 482 | |
| 483 | /* documentation is in freetype.h */ |
| 484 | |
| 485 | static __inline FT_Int32 |
| 486 | FT_MulFix_i386( FT_Int32 a, |
| 487 | FT_Int32 b ) |
| 488 | { |
| 489 | register FT_Int32 result; |
| 490 | |
| 491 | __asm |
| 492 | { |
| 493 | mov eax, a |
| 494 | mov edx, b |
| 495 | imul edx |
| 496 | mov ecx, edx |
| 497 | sar ecx, 31 |
| 498 | add ecx, 8000h |
| 499 | add eax, ecx |
| 500 | adc edx, 0 |
| 501 | shr eax, 16 |
| 502 | shl edx, 16 |
| 503 | add eax, edx |
| 504 | mov result, eax |
| 505 | } |
| 506 | return result; |
| 507 | } |
| 508 | |
| 509 | #endif /* _M_IX86 */ |
| 510 | |
| 511 | #endif /* _MSC_VER */ |
| 512 | |
| 513 | |
| 514 | #if defined( __GNUC__ ) && defined( __x86_64__ ) |
| 515 | |
| 516 | #define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64 |
| 517 | |
| 518 | static __inline__ FT_Int32 |
| 519 | FT_MulFix_x86_64( FT_Int32 a, |
| 520 | FT_Int32 b ) |
| 521 | { |
| 522 | /* Temporarily disable the warning that C90 doesn't support */ |
| 523 | /* `long long'. */ |
| 524 | #if ( __GNUC__ > 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) |
| 525 | #pragma GCC diagnostic push |
| 526 | #pragma GCC diagnostic ignored "-Wlong-long" |
| 527 | #endif |
| 528 | |
| 529 | #if 1 |
| 530 | /* Technically not an assembly fragment, but GCC does a really good */ |
| 531 | /* job at inlining it and generating good machine code for it. */ |
| 532 | long long ret, tmp; |
| 533 | |
| 534 | |
| 535 | ret = (long long)a * b; |
| 536 | tmp = ret >> 63; |
| 537 | ret += 0x8000 + tmp; |
| 538 | |
| 539 | return (FT_Int32)( ret >> 16 ); |
| 540 | #else |
| 541 | |
| 542 | /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */ |
| 543 | /* code from the lines below. The main issue is that `wide_a' is not */ |
| 544 | /* properly initialized by sign-extending `a'. Instead, the generated */ |
| 545 | /* machine code assumes that the register that contains `a' on input */ |
| 546 | /* can be used directly as a 64-bit value, which is wrong most of the */ |
| 547 | /* time. */ |
| 548 | long long wide_a = (long long)a; |
| 549 | long long wide_b = (long long)b; |
| 550 | long long result; |
| 551 | |
| 552 | |
| 553 | __asm__ __volatile__ ( |
| 554 | "imul %2, %1\n" |
| 555 | "mov %1, %0\n" |
| 556 | "sar $63, %0\n" |
| 557 | "lea 0x8000(%1, %0), %0\n" |
| 558 | "sar $16, %0\n" |
| 559 | : "=&r" (result), "=&r" (wide_a) |
| 560 | : "r" (wide_b) |
| 561 | : "cc" ); |
| 562 | |
| 563 | return (FT_Int32)result; |
| 564 | #endif |
| 565 | |
| 566 | #if ( __GNUC__ > 4 ) || ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) |
| 567 | #pragma GCC diagnostic pop |
| 568 | #endif |
| 569 | } |
| 570 | |
| 571 | #endif /* __GNUC__ && __x86_64__ */ |
| 572 | |
| 573 | #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ |
| 574 | |
| 575 | |
| 576 | #ifdef FT_CONFIG_OPTION_INLINE_MULFIX |
| 577 | #ifdef FT_MULFIX_ASSEMBLER |
| 578 | #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER |
| 579 | #endif |
| 580 | #endif |
| 581 | |
| 582 | |
| 583 | #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
| 584 | |
| 585 | #define FT_LOCAL( x ) static x |
| 586 | #define FT_LOCAL_DEF( x ) static x |
| 587 | |
| 588 | #else |
| 589 | |
| 590 | #ifdef __cplusplus |
| 591 | #define FT_LOCAL( x ) extern "C" x |
| 592 | #define FT_LOCAL_DEF( x ) extern "C" x |
| 593 | #else |
| 594 | #define FT_LOCAL( x ) extern x |
| 595 | #define FT_LOCAL_DEF( x ) x |
| 596 | #endif |
| 597 | |
| 598 | #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ |
| 599 | |
| 600 | #define FT_LOCAL_ARRAY( x ) extern const x |
| 601 | #define FT_LOCAL_ARRAY_DEF( x ) const x |
| 602 | |
| 603 | |
| 604 | #ifndef FT_BASE |
| 605 | |
| 606 | #ifdef __cplusplus |
| 607 | #define FT_BASE( x ) extern "C" x |
| 608 | #else |
| 609 | #define FT_BASE( x ) extern x |
| 610 | #endif |
| 611 | |
| 612 | #endif /* !FT_BASE */ |
| 613 | |
| 614 | |
| 615 | #ifndef FT_BASE_DEF |
| 616 | |
| 617 | #ifdef __cplusplus |
| 618 | #define FT_BASE_DEF( x ) x |
| 619 | #else |
| 620 | #define FT_BASE_DEF( x ) x |
| 621 | #endif |
| 622 | |
| 623 | #endif /* !FT_BASE_DEF */ |
| 624 | |
| 625 | |
| 626 | #ifndef FT_EXPORT |
| 627 | |
| 628 | #ifdef __cplusplus |
| 629 | #define FT_EXPORT( x ) extern "C" x |
| 630 | #else |
| 631 | #define FT_EXPORT( x ) extern x |
| 632 | #endif |
| 633 | |
| 634 | #endif /* !FT_EXPORT */ |
| 635 | |
| 636 | |
| 637 | #ifndef FT_EXPORT_DEF |
| 638 | |
| 639 | #ifdef __cplusplus |
| 640 | #define FT_EXPORT_DEF( x ) extern "C" x |
| 641 | #else |
| 642 | #define FT_EXPORT_DEF( x ) extern x |
| 643 | #endif |
| 644 | |
| 645 | #endif /* !FT_EXPORT_DEF */ |
| 646 | |
| 647 | |
| 648 | #ifndef FT_EXPORT_VAR |
| 649 | |
| 650 | #ifdef __cplusplus |
| 651 | #define FT_EXPORT_VAR( x ) extern "C" x |
| 652 | #else |
| 653 | #define FT_EXPORT_VAR( x ) extern x |
| 654 | #endif |
| 655 | |
| 656 | #endif /* !FT_EXPORT_VAR */ |
| 657 | |
| 658 | /* The following macros are needed to compile the library with a */ |
| 659 | /* C++ compiler and with 16bit compilers. */ |
| 660 | /* */ |
| 661 | |
| 662 | /* This is special. Within C++, you must specify `extern "C"' for */ |
| 663 | /* functions which are used via function pointers, and you also */ |
| 664 | /* must do that for structures which contain function pointers to */ |
| 665 | /* assure C linkage -- it's not possible to have (local) anonymous */ |
| 666 | /* functions which are accessed by (global) function pointers. */ |
| 667 | /* */ |
| 668 | /* */ |
| 669 | /* FT_CALLBACK_DEF is used to _define_ a callback function. */ |
| 670 | /* */ |
| 671 | /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ |
| 672 | /* contains pointers to callback functions. */ |
| 673 | /* */ |
| 674 | /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ |
| 675 | /* that contains pointers to callback functions. */ |
| 676 | /* */ |
| 677 | /* */ |
| 678 | /* Some 16bit compilers have to redefine these macros to insert */ |
| 679 | /* the infamous `_cdecl' or `__fastcall' declarations. */ |
| 680 | /* */ |
| 681 | #ifndef FT_CALLBACK_DEF |
| 682 | #ifdef __cplusplus |
| 683 | #define FT_CALLBACK_DEF( x ) extern "C" x |
| 684 | #else |
| 685 | #define FT_CALLBACK_DEF( x ) static x |
| 686 | #endif |
| 687 | #endif /* FT_CALLBACK_DEF */ |
| 688 | |
| 689 | #ifndef FT_CALLBACK_TABLE |
| 690 | #ifdef __cplusplus |
| 691 | #define FT_CALLBACK_TABLE extern "C" |
| 692 | #define FT_CALLBACK_TABLE_DEF extern "C" |
| 693 | #else |
| 694 | #define FT_CALLBACK_TABLE extern |
| 695 | #define FT_CALLBACK_TABLE_DEF /* nothing */ |
| 696 | #endif |
| 697 | #endif /* FT_CALLBACK_TABLE */ |
| 698 | |
| 699 | |
| 700 | FT_END_HEADER |
| 701 | |
| 702 | |
| 703 | #endif /* __FTCONFIG_H__ */ |
| 704 | |
| 705 | |
| 706 | /* END */ |
| 707 | |