Types: make SilcUInt32 an unsigned int in most cases.
authorKp <kp@valhallalegends.com>
Sun, 1 Jun 2008 04:57:51 +0000 (23:57 -0500)
committerKp <kp@valhallalegends.com>
Mon, 1 Sep 2008 19:48:40 +0000 (14:48 -0500)
On typical 32-bit systems, both unsigned int and unsigned long are 32
bits wide.  However, they have different format specifiers, so they
cannot be used interchangeably.  On typical 64-bit systems, unsigned int
is 32 bits and unsigned long is 64 bits.  To allow for a more consistent
format string, reorder the type size checks so that SilcUInt32 is an
unsigned int on both 32 bit and 64 bit systems.

lib/silcutil/silctypes.h

index b22c7e771d83b1de276eb8edf1aab09ff59aab90..d7f979766577c666ee2e5f6726ab4f2727bb28a4 100644 (file)
@@ -177,14 +177,14 @@ typedef signed short SilcInt16;
  *
  * SOURCE
  */
  *
  * SOURCE
  */
-#if SILC_SIZEOF_LONG == 4
-typedef unsigned long SilcUInt32;
-typedef signed long SilcInt32;
-#else
 #if SILC_SIZEOF_INT == 4
 typedef unsigned int SilcUInt32;
 typedef signed int SilcInt32;
 #else
 #if SILC_SIZEOF_INT == 4
 typedef unsigned int SilcUInt32;
 typedef signed int SilcInt32;
 #else
+#if SILC_SIZEOF_LONG == 4
+typedef unsigned long SilcUInt32;
+typedef signed long SilcInt32;
+#else
 #if SILC_SIZEOF_LONG_LONG >= 4
 #ifndef WIN32
 typedef unsigned long long SilcUInt32;
 #if SILC_SIZEOF_LONG_LONG >= 4
 #ifndef WIN32
 typedef unsigned long long SilcUInt32;