X-Git-Url: https://oss.titaniummirror.com/gitweb?p=msp430-binutils.git;a=blobdiff_plain;f=libiberty%2Fhashtab.c;fp=libiberty%2Fhashtab.c;h=8c89bfcd8393e8fde1e6b38847bd85f618c5ae25;hp=bf34a6d297ed09630aa6754c48df4ede92f4452a;hb=d5da4f291af551c0b8b79e1d4a9b173d60e5c10e;hpb=7b5ea4fcdf2819e070665ab5610f8b48e3867c10 diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index bf34a6d..8c89bfc 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -1,5 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). @@ -50,6 +50,9 @@ Boston, MA 02110-1301, USA. */ #ifdef HAVE_LIMITS_H #include #endif +#ifdef HAVE_INTTYPES_H +#include +#endif #ifdef HAVE_STDINT_H #include #endif @@ -196,7 +199,7 @@ higher_prime_index (unsigned long n) static hashval_t hash_pointer (const PTR p) { - return (hashval_t) ((long)p >> 3); + return (hashval_t) ((intptr_t)p >> 3); } /* Returns non-zero if P1 and P2 are equal. */ @@ -759,7 +762,8 @@ htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info) void htab_traverse (htab_t htab, htab_trav callback, PTR info) { - if (htab_elements (htab) * 8 < htab_size (htab)) + size_t size = htab_size (htab); + if (htab_elements (htab) * 8 < size && size > 32) htab_expand (htab); htab_traverse_noresize (htab, callback, info);