From 4a9f6c276daf54acbb2f5951f0435bfb6f014809 Mon Sep 17 00:00:00 2001 From: Alexei Sheplyakov Date: Sun, 7 Sep 2008 22:17:55 +0400 Subject: [PATCH] utils.h: use (if available) instead of reinventing it. The argument of golden_ratio_hash() is as an integer of the same size as a void* pointer. Unfortunately ISO C++ 98 does not provide suitable typedef. Hence * use if available and define p_int to uintptr_t. Note: AC_PROG_CC already checks for this header, so no extra checks are necessary. * as a fallback define p_int to be unsigned long, this works on most systems I know of (the only exception is woe64). While at it, stop including "config.h" unconditionally. --- ginac/utils.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ginac/utils.h b/ginac/utils.h index a4af3300..eaa9a723 100644 --- a/ginac/utils.h +++ b/ginac/utils.h @@ -24,10 +24,15 @@ #ifndef __GINAC_UTILS_H__ #define __GINAC_UTILS_H__ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include +#ifdef HAVE_STDINT_H +#include // for uintptr_t +#endif #include "assertion.h" @@ -65,12 +70,8 @@ inline int compare_pointers(const T * a, const T * b) return 0; } -#if SIZEOF_VOID_P == SIZEOF_INT -typedef unsigned int p_int; -#elif SIZEOF_VOID_P == SIZEOF_LONG -typedef unsigned long p_int; -#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG -typedef unsigned long long p_int; +#ifdef HAVE_STDINT_H +typedef uintptr_t p_int; #else typedef unsigned long p_int; #endif -- 2.44.0