Mercurial > ms-int-types
comparison stdint.h @ 19:febb32e4ac04
Get rid of these compiler warnings when compiling for 32-bit:
warning C4311: 'type cast' : pointer truncation from 'void *' to 'uintptr_t'
warning C4312: 'type cast' : conversion from 'uintptr_t' to 'const void *' of greater size
author | ipse.c99@d525d15b-5824-0410-80a3-6185d19c2cde |
---|---|
date | Thu, 17 Jul 2008 05:47:22 +0000 |
parents | 5f2b8140b2cd |
children | 9be805b7c8c6 |
comparison
equal
deleted
inserted
replaced
18:eb2525abe43a | 19:febb32e4ac04 |
---|---|
1 // ISO C9x compliant stdint.h for Microsoft Visual Studio | 1 // ISO C9x compliant stdint.h for Microsoft Visual Studio |
2 // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 | 2 // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 |
3 // | 3 // |
4 // Copyright (c) 2006 Alexander Chemeris | 4 // Copyright (c) 2006-2008 Alexander Chemeris |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are met: | 7 // modification, are permitted provided that the following conditions are met: |
8 // | 8 // |
9 // 1. Redistributions of source code must retain the above copyright notice, | 9 // 1. Redistributions of source code must retain the above copyright notice, |
51 # include <wchar.h> | 51 # include <wchar.h> |
52 #if (_MSC_VER < 1300) && defined(__cplusplus) | 52 #if (_MSC_VER < 1300) && defined(__cplusplus) |
53 } | 53 } |
54 #endif | 54 #endif |
55 | 55 |
56 // Define _W64 macros to mark types changing their size, like intptr_t. | |
57 #ifndef _W64 | |
58 # if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 | |
59 # define _W64 __w64 | |
60 # else | |
61 # define _W64 | |
62 # endif | |
63 #endif | |
64 | |
65 | |
56 // 7.18.1 Integer types | 66 // 7.18.1 Integer types |
57 | 67 |
58 // 7.18.1.1 Exact-width integer types | 68 // 7.18.1.1 Exact-width integer types |
59 typedef __int8 int8_t; | 69 typedef __int8 int8_t; |
60 typedef __int16 int16_t; | 70 typedef __int16 int16_t; |
88 // 7.18.1.4 Integer types capable of holding object pointers | 98 // 7.18.1.4 Integer types capable of holding object pointers |
89 #ifdef _WIN64 // [ | 99 #ifdef _WIN64 // [ |
90 typedef __int64 intptr_t; | 100 typedef __int64 intptr_t; |
91 typedef unsigned __int64 uintptr_t; | 101 typedef unsigned __int64 uintptr_t; |
92 #else // _WIN64 ][ | 102 #else // _WIN64 ][ |
93 typedef int intptr_t; | 103 typedef _W64 int intptr_t; |
94 typedef unsigned int uintptr_t; | 104 typedef _W64 unsigned int uintptr_t; |
95 #endif // _WIN64 ] | 105 #endif // _WIN64 ] |
96 | 106 |
97 // 7.18.1.5 Greatest-width integer types | 107 // 7.18.1.5 Greatest-width integer types |
98 typedef int64_t intmax_t; | 108 typedef int64_t intmax_t; |
99 typedef uint64_t uintmax_t; | 109 typedef uint64_t uintmax_t; |