Optimize remove_duplicate_parse_states method
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
parent
e7217f1bac
commit
42d37656ea
4 changed files with 163 additions and 2 deletions
18
src/compiler/util/hash_combine.h
Normal file
18
src/compiler/util/hash_combine.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef COMPILER_UTIL_HASH_COMBINE_H_
|
||||
#define COMPILER_UTIL_HASH_COMBINE_H_
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace tree_sitter {
|
||||
namespace util {
|
||||
|
||||
template <class T>
|
||||
inline void hash_combine(std::size_t *seed, const T &new_value) {
|
||||
std::hash<T> hasher;
|
||||
*seed ^= hasher(new_value) + 0x9e3779b9 + (*seed << 6) + (*seed >> 2);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace tree_sitter
|
||||
|
||||
#endif // COMPILER_UTIL_HASH_COMBINE_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue