Make sure PTRDIFF_MIN, PTRDIFF_MAX, and SIZE_MAX have the proper types.
[pintos-anon] / src / lib / stdint.h
index 2f0218fab4667a04535f7909515b73680d4c75e3..745ae77861d49a4cfdc7ffd6fd2138d8109de364 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LIB_STDINT_H
-#define LIB_STDINT_H
+#ifndef __LIB_STDINT_H
+#define __LIB_STDINT_H
 
 typedef signed char int8_t;
 #define INT8_MAX 127
@@ -24,7 +24,7 @@ typedef unsigned short int uint16_t;
 #define UINT16_MAX 65535
 
 typedef unsigned int uint32_t;
-#define UINT32_MAX 4294967295
+#define UINT32_MAX 4294967295U
 
 typedef unsigned long long int uint64_t;
 #define UINT64_MAX 18446744073709551615ULL
@@ -43,9 +43,9 @@ typedef int64_t intmax_t;
 typedef uint64_t uintmax_t;
 #define UINTMAX_MAX UINT64_MAX
 
-#define PTRDIFF_MIN INT32_MIN
-#define PTRDIFF_MAX INT32_MAX
+#define PTRDIFF_MIN ((__PTRDIFF_TYPE__) INT32_MIN)
+#define PTRDIFF_MAX ((__PTRDIFF_TYPE__) INT32_MAX)
 
-#define SIZE_MAX UINT32_MAX
+#define SIZE_MAX ((__SIZE_TYPE__) UINT32_MAX)
 
 #endif /* lib/stdint.h */