Update ROCm for multi-target support
[deliverable/binutils-gdb.git] / gdb / bcache.h
index 15dcc63440f144e659dd076904fc5dfe0236605b..929375642046047641443de196a10b46614fdd85 100644 (file)
@@ -2,7 +2,7 @@
    Written by Fred Fish <fnf@cygnus.com>
    Rewritten by Jim Blandy <jimb@cygnus.com>
 
-   Copyright (C) 1999-2019 Free Software Foundation, Inc.
+   Copyright (C) 1999-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
   
 */
 
-struct bstring;
+namespace gdb {
 
-/* The hash functions */
-extern unsigned long hash (const void *addr, int length);
-extern unsigned long hash_continue (const void *addr, int length,
-                                    unsigned long h);
+struct bstring;
 
 struct bcache
 {
   /* Allocate a bcache.  HASH_FN and COMPARE_FN can be used to pass in
      custom hash, and compare functions to be used by this bcache.  If
-     HASH_FUNCTION is NULL hash() is used and if COMPARE_FUNCTION is
+     HASH_FUNCTION is NULL fast_hash() is used and if COMPARE_FUNCTION is
      NULL memcmp() is used.  */
 
   explicit bcache (unsigned long (*hash_fn)(const void *,
                                            int length) = nullptr,
                   int (*compare_fn)(const void *, const void *,
                                     int length) = nullptr)
-    : m_hash_function (hash_fn == nullptr ? hash : hash_fn),
+    : m_hash_function (hash_fn == nullptr ? default_hash : hash_fn),
       m_compare_function (compare_fn == nullptr ? compare : compare_fn)
   {
   }
@@ -217,8 +214,16 @@ private:
   /* Default compare function.  */
   static int compare (const void *addr1, const void *addr2, int length);
 
+  /* Default hash function.  */
+  static unsigned long default_hash (const void *ptr, int length)
+  {
+    return fast_hash (ptr, length, 0);
+  }
+
   /* Expand the hash table.  */
   void expand_hash_table ();
 };
 
+} /* namespace gdb */
+
 #endif /* BCACHE_H */
This page took 0.023728 seconds and 4 git commands to generate.