use proper 64bit casting for pointer-math
authorChristof Hanke <christof.hanke@rzg.mpg.de>
Fri, 19 Nov 2010 20:30:21 +0000 (21:30 +0100)
committerDerrick Brashear <shadow@dementia.org>
Sun, 21 Nov 2010 14:36:41 +0000 (06:36 -0800)
building with "./configure --enable-checking --enable-supergroups"
fails, because on 64bit, the casting in map.c gives a warning.
Just add another ifdef and cast according to the size of a pointer.

Change-Id: Icb35d79f56cf8fec48c863061a524f9e29e6acd8
Reviewed-on: http://gerrit.openafs.org/3341
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/ptserver/map.c

index 3ea4b26..c823516 100644 (file)
@@ -36,6 +36,9 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
 #include "map.h"
 
 #undef PRINT_MAP_ERROR
@@ -51,10 +54,10 @@ struct bitmap {
     int m_data[MDATA];
 };
 
-#define MAP(p) ((struct bitmap*)((int)(p)&~1))
-#define NEGMAP(p)      (((int)(p))&1)
+#define MAP(p) ((struct bitmap*)((intptr_t)(p)&~1))
+#define NEGMAP(p)      (((intptr_t)(p))&1)
 #define POSMAP(p)      (!NEGMAP(p))
-#define NOT_MAP(mp)    ((struct map *) (((int)(mp)) ^ 1))
+#define NOT_MAP(mp)    ((struct map *) (((intptr_t)(mp)) ^ 1))
 
 #define NUMBERTOBIT(n) ((n) & ((1<<LSHIFT)-1))
 #define NUMBERTOINDEX(n)       ((n>>LSHIFT) & ((1<<MSHIFT)-1))