]> git.saurik.com Git - wxWidgets.git/commitdiff
safer definitions for wx(U)Int32,16 (taken from intl.cpp)
authorVáclav Slavík <vslavik@fastmail.fm>
Fri, 15 Mar 2002 23:28:42 +0000 (23:28 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Fri, 15 Mar 2002 23:28:42 +0000 (23:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/defs.h

index 7d367a5f6d353367ba4508d58148c007b1145c47..910fa95d84a0091acf1039faf6945f93556b8a7c 100644 (file)
@@ -468,17 +468,43 @@ enum
 #define wxInt8    char    signed
 #define wxUint8   char  unsigned
 
-#if defined(__WIN16__) || (defined(SIZEOF_INT) && (SIZEOF_INT == 2))
-#define wxInt16    int    signed
-#define wxUint16   int  unsigned
-#define wxInt32   long    signed
-#define wxUint32  long  unsigned
-#else
-#define wxInt16  short    signed
-#define wxUint16 short  unsigned
-#define wxInt32    int    signed
-#define wxUint32   int  unsigned
-#endif
+#ifdef __WINDOWS__
+    #if defined(__WIN16__)
+        #define wxInt16    int    signed
+        #define wxUint16   int  unsigned
+        #define wxInt32   long    signed
+        #define wxUint32  long  unsigned
+    #elif defined(__WIN32__)
+        #define wxInt16  short    signed
+        #define wxUint16 short  unsigned
+        #define wxInt32    int    signed
+        #define wxUint32   int  unsigned
+    #else
+        // Win64 will have different type sizes
+        #error "Please define a 32 bit type"
+    #endif
+#else // !Windows
+    // SIZEOF_XXX are defined by configure
+    #if defined(SIZEOF_INT) && (SIZEOF_INT == 4)
+        #define wxInt16  short    signed
+        #define wxUint16 short  unsigned
+        #define wxInt32    int    signed
+        #define wxUint32   int  unsigned
+    #elif defined(SIZEOF_INT) && (SIZEOF_INT == 2)
+        #define wxInt16    int    signed
+        #define wxUint16   int  unsigned
+        #define wxInt32   long    signed
+        #define wxUint32  long  unsigned
+    #else
+        // assume sizeof(int) == 4 - what else can we do
+        wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
+
+        #define wxInt16  short    signed
+        #define wxUint16 short  unsigned
+        #define wxInt32    int    signed
+        #define wxUint32   int  unsigned
+    #endif
+#endif // Win/!Win
 
 #if defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
 #define wxInt64   long    signed