Fix inttypes.h and stdint.h for 64-bit (and C++11).

Change-Id: I394630348413c9aafcac137ce1ca5f0a93d9ab6f
This commit is contained in:
Elliott Hughes
2013-09-30 14:46:47 -07:00
parent 4d016c6a83
commit a9a02acc9f
2 changed files with 65 additions and 50 deletions

View File

@@ -25,17 +25,18 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _STDINT_H
#define _STDINT_H
#include <stddef.h>
#include <sys/_types.h>
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) || (__cplusplus >= 201103L)
# define __STDINT_LIMITS
#endif
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) || (__cplusplus >= 201103L)
# define __STDINT_MACROS
#endif
@@ -157,6 +158,14 @@ typedef int64_t int_fast64_t;
typedef uint64_t uint_least64_t;
typedef uint64_t uint_fast64_t;
#if __LP64__
# define __INT64_C(c) c ## L
# define __UINT64_C(c) c ## UL
#else
# define __INT64_C(c) c ## LL
# define __UINT64_C(c) c ## ULL
#endif
#ifdef __STDINT_LIMITS
# define INT64_MIN (__INT64_C(-9223372036854775807)-1)
# define INT64_MAX (__INT64_C(9223372036854775807))
@@ -170,9 +179,6 @@ typedef uint64_t uint_fast64_t;
# define UINT_FAST64_MAX UINT64_MAX
#endif
#define __INT64_C(c) c ## LL
#define __UINT64_C(c) c ## ULL
#ifdef __STDINT_MACROS
# define INT64_C(c) __INT64_C(c)
# define INT_LEAST64_C(c) INT64_C(c)