[svn] Use uintptr_t instead of unsigned long for integer representation of pointers.

This commit is contained in:
hniksic 2005-11-19 11:35:02 -08:00
parent 94a7163d4e
commit 3e145c6018
5 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,7 @@
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.

View File

@ -182,13 +182,14 @@ AC_CHECK_SIZEOF(short)
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>

View File

@ -1,3 +1,8 @@
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

View File

@ -170,7 +170,7 @@ struct hash_table {
-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
@ -709,7 +709,7 @@ make_nocase_string_hash_table (int items)
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);
@ -718,7 +718,7 @@ hash_pointer (const void *ptr)
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);
@ -728,7 +728,7 @@ hash_pointer (const void *ptr)
key += (key << 39);
key ^= (key >> 44);
#endif
return key;
return (unsigned long) key;
}
static int

View File

@ -207,4 +207,9 @@ typedef unsigned short uint32_t;
# 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 */