Call forget_cached_source_info to clear the stale source cache
[deliverable/binutils-gdb.git] / gdb / utils.h
index 76f0da69f712bce7f5559a37c4182d83d5352d8c..e837621a2bdfdb483d81794c58cfa5b03c5abd20 100644 (file)
 #include "gdbsupport/scoped_restore.h"
 #include <chrono>
 
+#ifdef HAVE_LIBXXHASH
+#include <xxhash.h>
+#endif
+
 struct completion_match_for_lcd;
 class compiled_regex;
 
@@ -101,8 +105,6 @@ extern int streq_hash (const void *, const void *);
 
 extern int subset_compare (const char *, const char *);
 
-int compare_positive_ints (const void *ap, const void *bp);
-
 /* Compare C strings for std::sort.  */
 
 static inline bool
@@ -569,4 +571,18 @@ extern void copy_bitwise (gdb_byte *dest, ULONGEST dest_offset,
                          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.  */
+
+static inline unsigned int
+fast_hash (const char* str, size_t len)
+{
+#ifdef HAVE_LIBXXHASH
+  return XXH64 (str, len, 0);
+#else
+  return iterative_hash (str, len, 0);
+#endif
+}
+
 #endif /* UTILS_H */
This page took 0.024441 seconds and 4 git commands to generate.