modernc.org/cc@v1.0.1/v2/headers/linux_amd64/usr/include/stdint.h (about)

     1  /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
     2     This file is part of the GNU C Library.
     3  
     4     The GNU C Library is free software; you can redistribute it and/or
     5     modify it under the terms of the GNU Lesser General Public
     6     License as published by the Free Software Foundation; either
     7     version 2.1 of the License, or (at your option) any later version.
     8  
     9     The GNU C Library is distributed in the hope that it will be useful,
    10     but WITHOUT ANY WARRANTY; without even the implied warranty of
    11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12     Lesser General Public License for more details.
    13  
    14     You should have received a copy of the GNU Lesser General Public
    15     License along with the GNU C Library; if not, see
    16     <http://www.gnu.org/licenses/>.  */
    17  
    18  /*
    19   *	ISO C99: 7.18 Integer types <stdint.h>
    20   */
    21  
    22  #ifndef _STDINT_H
    23  #define _STDINT_H	1
    24  
    25  #include <features.h>
    26  #include <bits/wchar.h>
    27  #include <bits/wordsize.h>
    28  
    29  /* Exact integral types.  */
    30  
    31  /* Signed.  */
    32  
    33  /* There is some amount of overlap with <sys/types.h> as known by inet code */
    34  #ifndef __int8_t_defined
    35  # define __int8_t_defined
    36  typedef signed char int8_t;
    37  typedef short int int16_t;
    38  typedef int int32_t;
    39  # if __WORDSIZE == 64
    40  typedef long int int64_t;
    41  # else
    42  __extension__ typedef long long int int64_t;
    43  # endif
    44  #endif
    45  
    46  /* Unsigned.  */
    47  typedef unsigned char uint8_t;
    48  typedef unsigned short int uint16_t;
    49  #ifndef __uint32_t_defined
    50  typedef unsigned int uint32_t;
    51  # define __uint32_t_defined
    52  #endif
    53  #if __WORDSIZE == 64
    54  typedef unsigned long int uint64_t;
    55  #else
    56  __extension__ typedef unsigned long long int uint64_t;
    57  #endif
    58  
    59  /* Small types.  */
    60  
    61  /* Signed.  */
    62  typedef signed char int_least8_t;
    63  typedef short int int_least16_t;
    64  typedef int int_least32_t;
    65  #if __WORDSIZE == 64
    66  typedef long int int_least64_t;
    67  #else
    68  __extension__ typedef long long int int_least64_t;
    69  #endif
    70  
    71  /* Unsigned.  */
    72  typedef unsigned char uint_least8_t;
    73  typedef unsigned short int uint_least16_t;
    74  typedef unsigned int uint_least32_t;
    75  #if __WORDSIZE == 64
    76  typedef unsigned long int uint_least64_t;
    77  #else
    78  __extension__ typedef unsigned long long int uint_least64_t;
    79  #endif
    80  
    81  /* Fast types.  */
    82  
    83  /* Signed.  */
    84  typedef signed char int_fast8_t;
    85  #if __WORDSIZE == 64
    86  typedef long int int_fast16_t;
    87  typedef long int int_fast32_t;
    88  typedef long int int_fast64_t;
    89  #else
    90  typedef int int_fast16_t;
    91  typedef int int_fast32_t;
    92  __extension__ typedef long long int int_fast64_t;
    93  #endif
    94  
    95  /* Unsigned.  */
    96  typedef unsigned char uint_fast8_t;
    97  #if __WORDSIZE == 64
    98  typedef unsigned long int uint_fast16_t;
    99  typedef unsigned long int uint_fast32_t;
   100  typedef unsigned long int uint_fast64_t;
   101  #else
   102  typedef unsigned int uint_fast16_t;
   103  typedef unsigned int uint_fast32_t;
   104  __extension__ typedef unsigned long long int uint_fast64_t;
   105  #endif
   106  
   107  /* Types for `void *' pointers.  */
   108  #if __WORDSIZE == 64
   109  # ifndef __intptr_t_defined
   110  typedef long int intptr_t;
   111  #  define __intptr_t_defined
   112  # endif
   113  typedef unsigned long int uintptr_t;
   114  #else
   115  # ifndef __intptr_t_defined
   116  typedef int intptr_t;
   117  #  define __intptr_t_defined
   118  # endif
   119  typedef unsigned int uintptr_t;
   120  #endif
   121  
   122  /* Largest integral types.  */
   123  #if __WORDSIZE == 64
   124  typedef long int intmax_t;
   125  typedef unsigned long int uintmax_t;
   126  #else
   127  __extension__ typedef long long int intmax_t;
   128  __extension__ typedef unsigned long long int uintmax_t;
   129  #endif
   130  
   131  # if __WORDSIZE == 64
   132  #  define __INT64_C(c)	c ## L
   133  #  define __UINT64_C(c)	c ## UL
   134  # else
   135  #  define __INT64_C(c)	c ## LL
   136  #  define __UINT64_C(c)	c ## ULL
   137  # endif
   138  
   139  /* Limits of integral types.  */
   140  
   141  /* Minimum of signed integral types.  */
   142  # define INT8_MIN		(-128)
   143  # define INT16_MIN		(-32767-1)
   144  # define INT32_MIN		(-2147483647-1)
   145  # define INT64_MIN		(-__INT64_C(9223372036854775807)-1)
   146  /* Maximum of signed integral types.  */
   147  # define INT8_MAX		(127)
   148  # define INT16_MAX		(32767)
   149  # define INT32_MAX		(2147483647)
   150  # define INT64_MAX		(__INT64_C(9223372036854775807))
   151  
   152  /* Maximum of unsigned integral types.  */
   153  # define UINT8_MAX		(255)
   154  # define UINT16_MAX		(65535)
   155  # define UINT32_MAX		(4294967295U)
   156  # define UINT64_MAX		(__UINT64_C(18446744073709551615))
   157  
   158  /* Minimum of signed integral types having a minimum size.  */
   159  # define INT_LEAST8_MIN		(-128)
   160  # define INT_LEAST16_MIN	(-32767-1)
   161  # define INT_LEAST32_MIN	(-2147483647-1)
   162  # define INT_LEAST64_MIN	(-__INT64_C(9223372036854775807)-1)
   163  /* Maximum of signed integral types having a minimum size.  */
   164  # define INT_LEAST8_MAX		(127)
   165  # define INT_LEAST16_MAX	(32767)
   166  # define INT_LEAST32_MAX	(2147483647)
   167  # define INT_LEAST64_MAX	(__INT64_C(9223372036854775807))
   168  
   169  /* Maximum of unsigned integral types having a minimum size.  */
   170  # define UINT_LEAST8_MAX	(255)
   171  # define UINT_LEAST16_MAX	(65535)
   172  # define UINT_LEAST32_MAX	(4294967295U)
   173  # define UINT_LEAST64_MAX	(__UINT64_C(18446744073709551615))
   174  
   175  /* Minimum of fast signed integral types having a minimum size.  */
   176  # define INT_FAST8_MIN		(-128)
   177  # if __WORDSIZE == 64
   178  #  define INT_FAST16_MIN	(-9223372036854775807L-1)
   179  #  define INT_FAST32_MIN	(-9223372036854775807L-1)
   180  # else
   181  #  define INT_FAST16_MIN	(-2147483647-1)
   182  #  define INT_FAST32_MIN	(-2147483647-1)
   183  # endif
   184  # define INT_FAST64_MIN		(-__INT64_C(9223372036854775807)-1)
   185  /* Maximum of fast signed integral types having a minimum size.  */
   186  # define INT_FAST8_MAX		(127)
   187  # if __WORDSIZE == 64
   188  #  define INT_FAST16_MAX	(9223372036854775807L)
   189  #  define INT_FAST32_MAX	(9223372036854775807L)
   190  # else
   191  #  define INT_FAST16_MAX	(2147483647)
   192  #  define INT_FAST32_MAX	(2147483647)
   193  # endif
   194  # define INT_FAST64_MAX		(__INT64_C(9223372036854775807))
   195  
   196  /* Maximum of fast unsigned integral types having a minimum size.  */
   197  # define UINT_FAST8_MAX		(255)
   198  # if __WORDSIZE == 64
   199  #  define UINT_FAST16_MAX	(18446744073709551615UL)
   200  #  define UINT_FAST32_MAX	(18446744073709551615UL)
   201  # else
   202  #  define UINT_FAST16_MAX	(4294967295U)
   203  #  define UINT_FAST32_MAX	(4294967295U)
   204  # endif
   205  # define UINT_FAST64_MAX	(__UINT64_C(18446744073709551615))
   206  
   207  /* Values to test for integral types holding `void *' pointer.  */
   208  # if __WORDSIZE == 64
   209  #  define INTPTR_MIN		(-9223372036854775807L-1)
   210  #  define INTPTR_MAX		(9223372036854775807L)
   211  #  define UINTPTR_MAX		(18446744073709551615UL)
   212  # else
   213  #  define INTPTR_MIN		(-2147483647-1)
   214  #  define INTPTR_MAX		(2147483647)
   215  #  define UINTPTR_MAX		(4294967295U)
   216  # endif
   217  
   218  /* Minimum for largest signed integral type.  */
   219  # define INTMAX_MIN		(-__INT64_C(9223372036854775807)-1)
   220  /* Maximum for largest signed integral type.  */
   221  # define INTMAX_MAX		(__INT64_C(9223372036854775807))
   222  
   223  /* Maximum for largest unsigned integral type.  */
   224  # define UINTMAX_MAX		(__UINT64_C(18446744073709551615))
   225  
   226  /* Limits of other integer types.  */
   227  
   228  /* Limits of `ptrdiff_t' type.  */
   229  # if __WORDSIZE == 64
   230  #  define PTRDIFF_MIN		(-9223372036854775807L-1)
   231  #  define PTRDIFF_MAX		(9223372036854775807L)
   232  # else
   233  #  define PTRDIFF_MIN		(-2147483647-1)
   234  #  define PTRDIFF_MAX		(2147483647)
   235  # endif
   236  
   237  /* Limits of `sig_atomic_t'.  */
   238  # define SIG_ATOMIC_MIN		(-2147483647-1)
   239  # define SIG_ATOMIC_MAX		(2147483647)
   240  
   241  /* Limit of `size_t' type.  */
   242  # if __WORDSIZE == 64
   243  #  define SIZE_MAX		(18446744073709551615UL)
   244  # else
   245  #  ifdef __WORDSIZE32_SIZE_ULONG
   246  #   define SIZE_MAX		(4294967295UL)
   247  #  else
   248  #   define SIZE_MAX		(4294967295U)
   249  #  endif
   250  # endif
   251  
   252  /* Limits of `wchar_t'.  */
   253  # ifndef WCHAR_MIN
   254  /* These constants might also be defined in <wchar.h>.  */
   255  #  define WCHAR_MIN		__WCHAR_MIN
   256  #  define WCHAR_MAX		__WCHAR_MAX
   257  # endif
   258  
   259  /* Limits of `wint_t'.  */
   260  # define WINT_MIN		(0u)
   261  # define WINT_MAX		(4294967295u)
   262  
   263  /* Signed.  */
   264  # define INT8_C(c)	c
   265  # define INT16_C(c)	c
   266  # define INT32_C(c)	c
   267  # if __WORDSIZE == 64
   268  #  define INT64_C(c)	c ## L
   269  # else
   270  #  define INT64_C(c)	c ## LL
   271  # endif
   272  
   273  /* Unsigned.  */
   274  # define UINT8_C(c)	c
   275  # define UINT16_C(c)	c
   276  # define UINT32_C(c)	c ## U
   277  # if __WORDSIZE == 64
   278  #  define UINT64_C(c)	c ## UL
   279  # else
   280  #  define UINT64_C(c)	c ## ULL
   281  # endif
   282  
   283  /* Maximal type.  */
   284  # if __WORDSIZE == 64
   285  #  define INTMAX_C(c)	c ## L
   286  #  define UINTMAX_C(c)	c ## UL
   287  # else
   288  #  define INTMAX_C(c)	c ## LL
   289  #  define UINTMAX_C(c)	c ## ULL
   290  # endif
   291  
   292  #endif				/* stdint.h */