tfile_target::close: trace_fd can't be -1
[deliverable/binutils-gdb.git] / libiberty / hashtab.c
index a2fe3ee3bddbff6745024ea3b01df707744574ba..9f917c3571d96a6ebd1e472f85bb85787f715a6c 100644 (file)
@@ -1,6 +1,5 @@
 /* An expandable hash tables datatype.  
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1999-2019 Free Software Foundation, Inc.
    Contributed by Vladimir Makarov (vmakarov@cygnus.com).
 
 This file is part of the libiberty library.
@@ -726,7 +725,7 @@ htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
   PTR *slot;
 
   slot = htab_find_slot_with_hash (htab, element, hash, NO_INSERT);
-  if (*slot == HTAB_EMPTY_ENTRY)
+  if (slot == NULL)
     return;
 
   if (htab->del_f)
@@ -962,17 +961,17 @@ iterative_hash (const PTR k_in /* the key */,
   c += length;
   switch(len)              /* all the case statements fall through */
     {
-    case 11: c+=((hashval_t)k[10]<<24);
-    case 10: c+=((hashval_t)k[9]<<16);
-    case 9 : c+=((hashval_t)k[8]<<8);
+    case 11: c+=((hashval_t)k[10]<<24);        /* fall through */
+    case 10: c+=((hashval_t)k[9]<<16); /* fall through */
+    case 9 : c+=((hashval_t)k[8]<<8);  /* fall through */
       /* the first byte of c is reserved for the length */
-    case 8 : b+=((hashval_t)k[7]<<24);
-    case 7 : b+=((hashval_t)k[6]<<16);
-    case 6 : b+=((hashval_t)k[5]<<8);
-    case 5 : b+=k[4];
-    case 4 : a+=((hashval_t)k[3]<<24);
-    case 3 : a+=((hashval_t)k[2]<<16);
-    case 2 : a+=((hashval_t)k[1]<<8);
+    case 8 : b+=((hashval_t)k[7]<<24); /* fall through */
+    case 7 : b+=((hashval_t)k[6]<<16); /* fall through */
+    case 6 : b+=((hashval_t)k[5]<<8);  /* fall through */
+    case 5 : b+=k[4];                  /* fall through */
+    case 4 : a+=((hashval_t)k[3]<<24); /* fall through */
+    case 3 : a+=((hashval_t)k[2]<<16); /* fall through */
+    case 2 : a+=((hashval_t)k[1]<<8);  /* fall through */
     case 1 : a+=k[0];
       /* case 0: nothing left to add */
     }
@@ -990,17 +989,8 @@ hash_pointer (const PTR p)
   unsigned a, b, c;
 
   a = b = 0x9e3779b9;
-  if (sizeof (intptr_t) == 4) 
-    {
-      /* Mix as 16bit for now */
-      a += v >> 16;
-      b += v & 0xffff;
-    }
-  else
-    {
-      a += v >> 32;
-      b += v & 0xffffffff;
-    }
+  a += v >> (sizeof (intptr_t) * CHAR_BIT / 2);
+  b += v & (((intptr_t) 1 << (sizeof (intptr_t) * CHAR_BIT / 2)) - 1);
   c = 0x42135234;
   mix (a, b, c);
   return c;
This page took 0.026375 seconds and 4 git commands to generate.