From 279ed5189c9670a920eba069ba72e4fb3db0922f Mon Sep 17 00:00:00 2001 From: Ken Dyck Date: Thu, 19 Nov 2009 14:03:24 +0000 Subject: [PATCH] Construct definition of SIZE_MAX from __SIZE_WIDTH__ to support targets of arbitrary widths. llvm-svn: 89347 --- clang/lib/Headers/stdint.h | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/clang/lib/Headers/stdint.h b/clang/lib/Headers/stdint.h index f7382e838a79..b95ae8fb42b2 100644 --- a/clang/lib/Headers/stdint.h +++ b/clang/lib/Headers/stdint.h @@ -608,22 +608,7 @@ typedef __stdint_exjoin3(uint, __INTMAX_WIDTH__, _t) uintmax_t; #define UINTPTR_MAX __stdint_exjoin3(UINT, __INTPTR_WIDTH__, _MAX) #define PTRDIFF_MIN __stdint_exjoin3( INT, __PTRDIFF_WIDTH__, _MIN) #define PTRDIFF_MAX __stdint_exjoin3( INT, __PTRDIFF_WIDTH__, _MAX) - -#if __POINTER_WIDTH__ == 64 - -#define SIZE_MAX UINT64_MAX - -#elif __POINTER_WIDTH__ == 32 - -#define SIZE_MAX UINT32_MAX - -#elif __POINTER_WIDTH__ == 16 - -#define SIZE_MAX UINT16_MAX - -#else -#error "unknown or unset pointer width!" -#endif +#define SIZE_MAX __stdint_exjoin3(UINT, __SIZE_WIDTH__, _MAX) /* C99 7.18.2.5 Limits of greatest-width integer types. */ #define INTMAX_MIN __stdint_exjoin3( INT, __INTMAX_WIDTH__, _MIN)