+2005-11-19 Hrvoje Niksic <hniksic@xemacs.org>
+
+ * configure.in: Check for uintptr_t.
+
2005-11-02 Mauro Tortonesi <mauro@ferrara.linux.it>
* Makefile.in: Improved support for unit testing.
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
+AC_CHECK_SIZEOF(void *)
dnl
dnl Checks for non-universal or system-specific types.
dnl
AC_TYPE_SIZE_T
AC_TYPE_PID_T
-AC_CHECK_TYPES(uint32_t)
+AC_CHECK_TYPES([uint32_t, uintptr_t])
AC_CHECK_TYPES(sig_atomic_t, [], [], [
#include <stdio.h>
#include <sys/types.h>
+2005-11-19 Hrvoje Niksic <hniksic@xemacs.org>
+
+ * hash.c (INVALID_PTR): Use uintptr_t instead of unsigned long.
+ (hash_pointer): Don't assume a pointer fits in `unsigned long'.
+
2005-11-02 Mauro Tortonesi <mauro@ferrara.linux.it>
* Makefile.in: Removed support for unit testing (now it is in
-1. This is acceptable because it still allows the use of
nonnegative integer keys. */
-#define INVALID_PTR ((void *) ~0UL)
+#define INVALID_PTR ((void *) ~(uintptr_t) 0)
#ifndef UCHAR_MAX
# define UCHAR_MAX 0xff
#endif
unsigned long
hash_pointer (const void *ptr)
{
- unsigned long key = (unsigned long) ptr;
+ uintptr_t key = (uintptr_t) ptr;
key += (key << 12);
key ^= (key >> 22);
key += (key << 4);
key ^= (key >> 2);
key += (key << 7);
key ^= (key >> 12);
-#if SIZEOF_LONG > 4
+#if SIZEOF_VOID_P > 4
key += (key << 44);
key ^= (key >> 54);
key += (key << 36);
key += (key << 39);
key ^= (key >> 44);
#endif
- return key;
+ return (unsigned long) key;
}
static int
# endif
#endif
+/* If uintptr_t isn't defined, simply typedef it to unsigned long. */
+#ifndef HAVE_UINTPTR_T
+typedef unsigned long uintptr_t;
+#endif
+
#endif /* SYSDEP_H */