@@ -70,6 +70,7 @@
#include <algorithm>
#include "gdbsupport/gdb_string_view.h"
#include "gdbsupport/pathstuff.h"
+#include "gdbsupport/common-utils.h"
/* Forward declarations for local functions. */
@@ -727,7 +728,7 @@
const struct demangled_name_entry *e
= (const struct demangled_name_entry *) data;
- return iterative_hash (e->mangled.data (), e->mangled.length (), 0);
+ return fast_hash (e->mangled.data (), e->mangled.length ());
}
/* Equality function for the demangled name hash. */
@@ -3436,6 +3436,14 @@
}
}
+/* See utils.h. */
+
+unsigned int
+fast_hash (const char* str, size_t len)
+{
+ return iterative_hash (str, len, 0);
+}
+
void
_initialize_utils (void)
{
@@ -569,4 +569,10 @@
const gdb_byte *source, ULONGEST source_offset,
ULONGEST nbits, int bits_big_endian);
+/* A fast hashing function. This can be used to hash strings in a fast way
+ when the length is known. If no fast hashing library is available, falls
+ back to iterative_hash from libiberty. */
+
+extern unsigned int fast_hash (const char* str, size_t len);
+
#endif /* UTILS_H */