git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/include/stdint.h

      1 /*-------------------------------------------------------------------------
      2    stdint.h - ISO C99 7.18 Integer types <stdint.h>
      3 
      4    Copyright (C) 2005, Maarten Brock, sourceforge.brock@dse.nl
      5    Copyright (C) 2011, Philipp Klaus Krause, pkk@spth.de
      6 
      7    This library is free software; you can redistribute it and/or modify it
      8    under the terms of the GNU General Public License as published by the
      9    Free Software Foundation; either version 2, or (at your option) any
     10    later version.
     11 
     12    This library is distributed in the hope that it will be useful,
     13    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     15    GNU General Public License for more details.
     16 
     17    You should have received a copy of the GNU General Public License 
     18    along with this library; see the file COPYING. If not, write to the
     19    Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
     20    MA 02110-1301, USA.
     21 
     22    As a special exception, if you link this library with other files,
     23    some of which are compiled with SDCC, to produce an executable,
     24    this library does not by itself cause the resulting executable to
     25    be covered by the GNU General Public License. This exception does
     26    not however invalidate any other reasons why the executable file
     27    might be covered by the GNU General Public License.
     28 -------------------------------------------------------------------------*/
     29 
     30 #ifndef _STDINT_H
     31 #define _STDINT_H       1
     32 
     33 /* Exact integral types.  */
     34 
     35 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16)
     36 #if __STDC_VERSION__ >= 199901L
     37 #define __SDCC_LONGLONG
     38 #endif
     39 #endif
     40 
     41 /* Signed.  */
     42 
     43 typedef signed char             int8_t;
     44 typedef short int               int16_t;
     45 typedef long int                int32_t;
     46 #ifdef __SDCC_LONGLONG
     47 typedef long long int           int64_t;
     48 #endif
     49 
     50 /* Unsigned.  */
     51 typedef unsigned char           uint8_t;
     52 typedef unsigned short int      uint16_t;
     53 typedef unsigned long int       uint32_t;
     54 #ifdef __SDCC_LONGLONG
     55 typedef unsigned long long int  uint64_t;
     56 #endif
     57 
     58 /* Small types.  */
     59 
     60 /* Signed.  */
     61 typedef signed char             int_least8_t;
     62 typedef short int               int_least16_t;
     63 typedef long int                int_least32_t;
     64 #ifdef __SDCC_LONGLONG
     65 typedef long long int           int_least64_t;
     66 #endif
     67 
     68 /* Unsigned.  */
     69 typedef unsigned char           uint_least8_t;
     70 typedef unsigned short int      uint_least16_t;
     71 typedef unsigned long int       uint_least32_t;
     72 #ifdef __SDCC_LONGLONG
     73 typedef unsigned long long int  uint_least64_t;
     74 #endif
     75 
     76 /* Fast types.  */
     77 
     78 /* Signed.  */
     79 typedef signed char             int_fast8_t;
     80 typedef int                     int_fast16_t;
     81 typedef long int                int_fast32_t;
     82 #ifdef __SDCC_LONGLONG
     83 typedef long long int           int_fast64_t;
     84 #endif
     85 
     86 /* Unsigned.  */
     87 typedef unsigned char           uint_fast8_t;
     88 typedef unsigned int            uint_fast16_t;
     89 typedef unsigned long int       uint_fast32_t;
     90 #ifdef __SDCC_LONGLONG
     91 typedef unsigned long long int  uint_fast64_t;
     92 #endif
     93 
     94 /* Types for `void *' pointers.  */
     95 #if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
     96   typedef long int              intptr_t;
     97   typedef unsigned long int     uintptr_t;
     98 #else
     99   typedef int                   intptr_t;
    100   typedef unsigned int          uintptr_t;
    101 #endif
    102 
    103 
    104 /* Largest integral types.  */
    105 #ifndef __SDCC_LONGLONG
    106 typedef long int                intmax_t;
    107 typedef unsigned long int       uintmax_t;
    108 #else
    109 typedef long long int           intmax_t;
    110 typedef unsigned long long int  uintmax_t;
    111 #endif
    112 
    113 /* Limits of integral types.  */
    114 
    115 /* Minimum of signed integral types.  */
    116 #define INT8_MIN               (-128)
    117 #define INT16_MIN              (-32767-1)
    118 #define INT32_MIN              (-2147483647L-1)
    119 #ifdef __SDCC_LONGLONG
    120 #define INT64_MIN              (-9223372036854775807LL-1)
    121 #endif
    122 
    123 /* Maximum of signed integral types.  */
    124 #define INT8_MAX               (127)
    125 #define INT16_MAX              (32767)
    126 #define INT32_MAX              (2147483647L)
    127 #ifdef __SDCC_LONGLONG
    128 #define INT64_MAX              (9223372036854775807LL)
    129 #endif
    130 
    131 /* Maximum of unsigned integral types.  */
    132 #define UINT8_MAX              (255)
    133 #define UINT16_MAX             (65535)
    134 #define UINT32_MAX             (4294967295UL)
    135 #ifdef __SDCC_LONGLONG
    136 #define UINT64_MAX             (18446744073709551615ULL)
    137 #endif
    138 
    139 /* Minimum of signed integral types having a minimum size.  */
    140 #define INT_LEAST8_MIN         INT8_MIN
    141 #define INT_LEAST16_MIN        INT16_MIN
    142 #define INT_LEAST32_MIN        INT32_MIN
    143 #ifdef __SDCC_LONGLONG
    144 #define INT_LEAST64_MIN        INT64_MIN
    145 #endif
    146 
    147 /* Maximum of signed integral types having a minimum size.  */
    148 #define INT_LEAST8_MAX         INT8_MAX
    149 #define INT_LEAST16_MAX        INT16_MAX
    150 #define INT_LEAST32_MAX        INT32_MAX
    151 #ifdef __SDCC_LONGLONG
    152 #define INT_LEAST64_MAX        INT64_MAX
    153 #endif
    154 
    155 /* Maximum of unsigned integral types having a minimum size.  */
    156 #define UINT_LEAST8_MAX        UINT8_MAX
    157 #define UINT_LEAST16_MAX       UINT16_MAX
    158 #define UINT_LEAST32_MAX       UINT32_MAX
    159 #ifdef __SDCC_LONGLONG
    160 #define UINT_LEAST64_MAX       UINT64_MAX
    161 #endif
    162 
    163 /* Minimum of fast signed integral types having a minimum size.  */
    164 #define INT_FAST8_MIN          INT8_MIN
    165 #define INT_FAST16_MIN         INT16_MIN
    166 #define INT_FAST32_MIN         INT32_MIN
    167 #ifdef __SDCC_LONGLONG
    168 #define INT_FAST64_MIN         INT64_MIN
    169 #endif
    170 
    171 /* Maximum of fast signed integral types having a minimum size.  */
    172 #define INT_FAST8_MAX          INT8_MAX
    173 #define INT_FAST16_MAX         INT16_MAX
    174 #define INT_FAST32_MAX         INT32_MAX
    175 #ifdef __SDCC_LONGLONG
    176 #define INT_FAST64_MAX         INT64_MAX
    177 #endif
    178 
    179 /* Maximum of fast unsigned integral types having a minimum size.  */
    180 #define UINT_FAST8_MAX         UINT8_MAX
    181 #define UINT_FAST16_MAX        UINT16_MAX
    182 #define UINT_FAST32_MAX        UINT32_MAX
    183 #ifdef __SDCC_LONGLONG
    184 #define UINT_FAST64_MAX        UINT64_MAX
    185 #endif
    186 
    187 /* Values to test for integral types holding `void *' pointer.  */
    188 #if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
    189 #define INTPTR_MIN             (-2147483647L-1)
    190 #define INTPTR_MAX             (2147483647L)
    191 #define UINTPTR_MAX            (4294967295UL)
    192 #else
    193 #define INTPTR_MIN             (-32767-1)
    194 #define INTPTR_MAX             (32767)
    195 #define UINTPTR_MAX            (65535)
    196 #endif
    197 
    198 /* Minimum for largest signed integral type.  */
    199 #ifndef __SDCC_LONGLONG
    200 #define INTMAX_MIN             (-2147483647L-1)
    201 #else
    202 #define INTMAX_MIN             (-9223372036854775807LL-1)
    203 #endif
    204 
    205 /* Maximum for largest signed integral type.  */
    206 #ifndef __SDCC_LONGLONG
    207 #define INTMAX_MAX             (2147483647L)
    208 #else
    209 #define INTMAX_MAX             (9223372036854775807LL)
    210 #endif
    211 
    212 /* Maximum for largest unsigned integral type.  */
    213 #ifndef __SDCC_LONGLONG
    214 #define UINTMAX_MAX            (4294967295UL)
    215 #else
    216 #define UINTMAX_MAX            (18446744073709551615ULL)
    217 #endif
    218 
    219 /* Limits of other integer types.  */
    220 
    221 /* Limits of `ptrdiff_t' type.  */
    222 #if defined (__SDCC_mcs51) || defined (__SDCC_ds390)
    223 #define PTRDIFF_MIN           (-2147483647L-1)
    224 #define PTRDIFF_MAX           (2147483647L)
    225 #else
    226 #define PTRDIFF_MIN           (-32767-1)
    227 #define PTRDIFF_MAX           (32767)
    228 #endif
    229 
    230 /* */
    231 #define SIG_ATOMIC_MIN        (0)
    232 #define SIG_ATOMIC_MAX        (255)
    233 
    234 /* Limit of `size_t' type.  */
    235 #define SIZE_MAX               (65535u)
    236 
    237 /* Signed.  */
    238 #define INT8_C(c)      c
    239 #define INT16_C(c)     c
    240 #define INT32_C(c)     c ## L
    241 #ifdef __SDCC_LONGLONG
    242 #define INT64_C(c)     c ## LL
    243 #endif
    244 
    245 /* Unsigned.  */
    246 #define UINT8_C(c)     c ## U
    247 #define UINT16_C(c)    c ## U
    248 #define UINT32_C(c)    c ## UL
    249 #ifdef __SDCC_LONGLONG
    250 #define UINT64_C(c)    c ## ULL
    251 #endif
    252 
    253 #define WCHAR_MIN      0
    254 #define WCHAR_MAX      0xffffffff
    255 
    256 #define WINT_MIN       0
    257 #define WINT_MAX       0xffffffff
    258 
    259 /* Maximal type.  */
    260 #ifdef __SDCC_LONGLONG
    261 #define INTMAX_C(c)    c ## LL
    262 #define UINTMAX_C(c)   c ## ULL
    263 #else
    264 #define INTMAX_C(c)    c ## L
    265 #define UINTMAX_C(c)   c ## UL
    266 #endif
    267 
    268 /* Bounds-checking interfaces from annex K of the C11 standard. */
    269 #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__
    270 #define RSIZE_MAX SIZE_MAX
    271 #endif
    272 
    273 #endif /* stdint.h */
    274 

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.