Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:35:45

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