Skip to content

Commit

Permalink
Get rid of these compiler warnings when compiling for 32-bit:
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
chemeris committed Jul 17, 2008
1 parent 008aaa4 commit e98ba9d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions stdint.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006 Alexander Chemeris
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -53,6 +53,16 @@
}
#endif

// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif


// 7.18.1 Integer types

// 7.18.1.1 Exact-width integer types
Expand Down Expand Up @@ -90,8 +100,8 @@ typedef uint64_t uint_fast64_t;
typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef int intptr_t;
typedef unsigned int uintptr_t;
typedef _W64 int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]

// 7.18.1.5 Greatest-width integer types
Expand Down

0 comments on commit e98ba9d

Please sign in to comment.