root/opal/include/opal_stdint.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * Copyright (c) 2016      Research Organization for Information Science
  16  *                         and Technology (RIST). All rights reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  *
  23  * This file includes the C99 stdint.h file if available, and otherwise
  24  * defines fixed-width types according to the SIZEOF information
  25  * gathered by configure.
  26  */
  27 
  28 #ifndef OPAL_STDINT_H
  29 #define OPAL_STDINT_H 1
  30 
  31 #include "opal_config.h"
  32 
  33 /*
  34  * Include what we can and define what is missing.
  35  */
  36 #include <limits.h>
  37 #include <stdint.h>
  38 
  39 #ifdef HAVE_SYS_TYPES_H
  40 #include <sys/types.h>
  41 #endif
  42 
  43 /* 128-bit */
  44 
  45 #ifdef HAVE_INT128_T
  46 
  47 typedef int128_t opal_int128_t;
  48 typedef uint128_t opal_uint128_t;
  49 
  50 #define HAVE_OPAL_INT128_T 1
  51 
  52 #elif defined(HAVE___INT128)
  53 
  54 /* suppress warning about __int128 type */
  55 #pragma GCC diagnostic push
  56 /* Clang won't quietly accept "-pedantic", but GCC versions older than ~4.8
  57  * won't quietly accept "-Wpedanic".  The whole "#pragma GCC diagnostic ..."
  58  * facility only was added to GCC as of version 4.6. */
  59 #if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 6)
  60 #pragma GCC diagnostic ignored "-Wpedantic"
  61 #else
  62 #pragma GCC diagnostic ignored "-pedantic"
  63 #endif
  64 typedef __int128 opal_int128_t;
  65 typedef unsigned __int128 opal_uint128_t;
  66 #pragma GCC diagnostic pop
  67 
  68 #define HAVE_OPAL_INT128_T 1
  69 
  70 #else
  71 
  72 #define HAVE_OPAL_INT128_T 0
  73 
  74 #endif
  75 
  76 /* Pointers */
  77 
  78 #if SIZEOF_VOID_P == SIZEOF_INT
  79 
  80 #ifndef HAVE_INTPTR_T
  81 typedef signed int intptr_t;
  82 #endif
  83 
  84 #ifndef HAVE_UINTPTR_T
  85 typedef unsigned int uintptr_t;
  86 #endif
  87 
  88 #elif SIZEOF_VOID_P == SIZEOF_LONG
  89 
  90 #ifndef HAVE_INTPTR_T
  91 typedef signed long intptr_t;
  92 #endif
  93 
  94 #ifndef HAVE_UINTPTR_T
  95 typedef unsigned long uintptr_t;
  96 #endif
  97 
  98 #elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
  99 
 100 #ifndef HAVE_INTPTR_T
 101 typedef signed long long intptr_t;
 102 #endif
 103 #ifndef HAVE_UINTPTR_T
 104 typedef unsigned long long uintptr_t;
 105 #endif
 106 
 107 #else
 108 
 109 #error Failed to define pointer-sized integer types
 110 
 111 #endif
 112 
 113 /* inttypes.h printf specifiers */
 114 # include <inttypes.h>
 115 
 116 #ifndef PRIsize_t
 117 # if defined(ACCEPT_C99)
 118 #   define PRIsize_t "zu"
 119 # elif SIZEOF_SIZE_T == SIZEOF_LONG
 120 #   define PRIsize_t "lu"
 121 # elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
 122 #   define PRIsize_t "llu"
 123 # else
 124 #   define PRIsize_t "u"
 125 # endif
 126 #endif
 127 
 128 #endif /* OPAL_STDINT_H */
 129 

/* [<][>][^][v][top][bottom][index][help] */