Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-13 08:25:19

0001 /****************************************************************************
0002  *
0003  * config/integer-types.h
0004  *
0005  *   FreeType integer types definitions.
0006  *
0007  * Copyright (C) 1996-2025 by
0008  * David Turner, Robert Wilhelm, and Werner Lemberg.
0009  *
0010  * This file is part of the FreeType project, and may only be used,
0011  * modified, and distributed under the terms of the FreeType project
0012  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
0013  * this file you indicate that you have read the license and
0014  * understand and accept it fully.
0015  *
0016  */
0017 #ifndef FREETYPE_CONFIG_INTEGER_TYPES_H_
0018 #define FREETYPE_CONFIG_INTEGER_TYPES_H_
0019 
0020 FT_BEGIN_HEADER
0021 
0022   /* There are systems (like the Texas Instruments 'C54x) where a `char`  */
0023   /* has 16~bits.  ANSI~C says that `sizeof(char)` is always~1.  Since an */
0024   /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which  */
0025   /* is probably unexpected.                                              */
0026   /*                                                                      */
0027   /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a     */
0028   /* `char` type.                                                         */
0029 
0030 #ifndef FT_CHAR_BIT
0031 #define FT_CHAR_BIT  CHAR_BIT
0032 #endif
0033 
0034 #ifndef FT_SIZEOF_INT
0035 
0036   /* The size of an `int` type. */
0037 #if                                 FT_UINT_MAX == 0xFFFFUL
0038 #define FT_SIZEOF_INT  ( 16 / FT_CHAR_BIT )
0039 #elif                               FT_UINT_MAX == 0xFFFFFFFFUL
0040 #define FT_SIZEOF_INT  ( 32 / FT_CHAR_BIT )
0041 #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
0042 #define FT_SIZEOF_INT  ( 64 / FT_CHAR_BIT )
0043 #else
0044 #error "Unsupported size of `int' type!"
0045 #endif
0046 
0047 #endif  /* !defined(FT_SIZEOF_INT) */
0048 
0049 #ifndef FT_SIZEOF_LONG
0050 
0051   /* The size of a `long` type.  A five-byte `long` (as used e.g. on the */
0052   /* DM642) is recognized but avoided.                                   */
0053 #if                                  FT_ULONG_MAX == 0xFFFFFFFFUL
0054 #define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
0055 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
0056 #define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
0057 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
0058 #define FT_SIZEOF_LONG  ( 64 / FT_CHAR_BIT )
0059 #else
0060 #error "Unsupported size of `long' type!"
0061 #endif
0062 
0063 #endif /* !defined(FT_SIZEOF_LONG) */
0064 
0065 #ifndef FT_SIZEOF_LONG_LONG
0066 
0067   /* The size of a `long long` type if available */
0068 #if defined( FT_ULLONG_MAX ) && FT_ULLONG_MAX >= 0xFFFFFFFFFFFFFFFFULL
0069 #define FT_SIZEOF_LONG_LONG  ( 64 / FT_CHAR_BIT )
0070 #else
0071 #define FT_SIZEOF_LONG_LONG  0
0072 #endif
0073 
0074 #endif /* !defined(FT_SIZEOF_LONG_LONG) */
0075 
0076 
0077   /**************************************************************************
0078    *
0079    * @section:
0080    *   basic_types
0081    *
0082    */
0083 
0084 
0085   /**************************************************************************
0086    *
0087    * @type:
0088    *   FT_Int16
0089    *
0090    * @description:
0091    *   A typedef for a 16bit signed integer type.
0092    */
0093   typedef signed short  FT_Int16;
0094 
0095 
0096   /**************************************************************************
0097    *
0098    * @type:
0099    *   FT_UInt16
0100    *
0101    * @description:
0102    *   A typedef for a 16bit unsigned integer type.
0103    */
0104   typedef unsigned short  FT_UInt16;
0105 
0106   /* */
0107 
0108 
0109   /* this #if 0 ... #endif clause is for documentation purposes */
0110 #if 0
0111 
0112   /**************************************************************************
0113    *
0114    * @type:
0115    *   FT_Int32
0116    *
0117    * @description:
0118    *   A typedef for a 32bit signed integer type.  The size depends on the
0119    *   configuration.
0120    */
0121   typedef signed XXX  FT_Int32;
0122 
0123 
0124   /**************************************************************************
0125    *
0126    * @type:
0127    *   FT_UInt32
0128    *
0129    *   A typedef for a 32bit unsigned integer type.  The size depends on the
0130    *   configuration.
0131    */
0132   typedef unsigned XXX  FT_UInt32;
0133 
0134 
0135   /**************************************************************************
0136    *
0137    * @type:
0138    *   FT_Int64
0139    *
0140    *   A typedef for a 64bit signed integer type.  The size depends on the
0141    *   configuration.  Only defined if there is real 64bit support;
0142    *   otherwise, it gets emulated with a structure (if necessary).
0143    */
0144   typedef signed XXX  FT_Int64;
0145 
0146 
0147   /**************************************************************************
0148    *
0149    * @type:
0150    *   FT_UInt64
0151    *
0152    *   A typedef for a 64bit unsigned integer type.  The size depends on the
0153    *   configuration.  Only defined if there is real 64bit support;
0154    *   otherwise, it gets emulated with a structure (if necessary).
0155    */
0156   typedef unsigned XXX  FT_UInt64;
0157 
0158   /* */
0159 
0160 #endif
0161 
0162 #if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
0163 
0164   typedef signed int      FT_Int32;
0165   typedef unsigned int    FT_UInt32;
0166 
0167 #elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
0168 
0169   typedef signed long     FT_Int32;
0170   typedef unsigned long   FT_UInt32;
0171 
0172 #else
0173 #error "no 32bit type found -- please check your configuration files"
0174 #endif
0175 
0176 
0177   /* look up an integer type that is at least 32~bits */
0178 #if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
0179 
0180   typedef int            FT_Fast;
0181   typedef unsigned int   FT_UFast;
0182 
0183 #elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
0184 
0185   typedef long           FT_Fast;
0186   typedef unsigned long  FT_UFast;
0187 
0188 #endif
0189 
0190 
0191   /* determine whether we have a 64-bit integer type */
0192 #if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
0193 
0194 #define FT_INT64   long
0195 #define FT_UINT64  unsigned long
0196 
0197 #elif FT_SIZEOF_LONG_LONG >= ( 64 / FT_CHAR_BIT )
0198 
0199 #define FT_INT64   long long int
0200 #define FT_UINT64  unsigned long long int
0201 
0202   /**************************************************************************
0203    *
0204    * A 64-bit data type may create compilation problems if you compile in
0205    * strict ANSI mode.  To avoid them, we disable other 64-bit data types if
0206    * `__STDC__` is defined.  You can however ignore this rule by defining the
0207    * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
0208    */
0209 #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
0210 
0211 #if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
0212 
0213   /* this compiler provides the `__int64` type */
0214 #define FT_INT64   __int64
0215 #define FT_UINT64  unsigned __int64
0216 
0217 #elif defined( __BORLANDC__ )  /* Borland C++ */
0218 
0219   /* XXXX: We should probably check the value of `__BORLANDC__` in order */
0220   /*       to test the compiler version.                                 */
0221 
0222   /* this compiler provides the `__int64` type */
0223 #define FT_INT64   __int64
0224 #define FT_UINT64  unsigned __int64
0225 
0226 #elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100  /* Watcom C++ */
0227 
0228 #define FT_INT64   long long int
0229 #define FT_UINT64  unsigned long long int
0230 
0231 #elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
0232 
0233 #define FT_INT64   long long int
0234 #define FT_UINT64  unsigned long long int
0235 
0236 #elif defined( __GNUC__ )
0237 
0238   /* GCC provides the `long long` type */
0239 #define FT_INT64   long long int
0240 #define FT_UINT64  unsigned long long int
0241 
0242 #endif /* !__STDC__ */
0243 
0244 #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
0245 
0246 #ifdef FT_INT64
0247 
0248   typedef FT_INT64   FT_Int64;
0249   typedef FT_UINT64  FT_UInt64;
0250 
0251 #  define FT_INT64_ZERO  0
0252 
0253 #else  /* !FT_INT64 */
0254 
0255   /* we need to emulate 64-bit data types if none are available */
0256 
0257   typedef struct  FT_Int64_
0258   {
0259     FT_UInt32  lo;
0260     FT_UInt32  hi;
0261 
0262   } FT_Int64;
0263 
0264   typedef struct  FT_UInt64_
0265   {
0266     FT_UInt32  lo;
0267     FT_UInt32  hi;
0268 
0269   } FT_UInt64;
0270 
0271 #  define FT_INT64_ZERO  { 0, 0 }
0272 
0273 #endif /* !FT_INT64 */
0274 
0275 FT_END_HEADER
0276 
0277 #endif  /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */