Optimize remove_duplicate_parse_states method

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Max Brunsfeld 2016-11-15 17:51:52 -08:00 committed by Nathan Sobo
parent e7217f1bac
commit 42d37656ea
4 changed files with 163 additions and 2 deletions

View 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_