mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ue2_literal: better hash function
This commit is contained in:
parent
1aad3b0ed1
commit
25170b32eb
@ -34,6 +34,7 @@
|
||||
|
||||
#include "charreach.h"
|
||||
#include "compare.h"
|
||||
#include "hash_dynamic_bitset.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
@ -325,6 +326,10 @@ bool ue2_literal::any_nocase() const {
|
||||
return nocase.any();
|
||||
}
|
||||
|
||||
size_t ue2_literal::hash() const {
|
||||
return hash_all(s, hash_dynamic_bitset()(nocase));
|
||||
}
|
||||
|
||||
void make_nocase(ue2_literal *lit) {
|
||||
ue2_literal rv;
|
||||
|
||||
|
@ -205,6 +205,8 @@ public:
|
||||
nocase.swap(other.nocase);
|
||||
}
|
||||
|
||||
size_t hash() const;
|
||||
|
||||
private:
|
||||
friend const_iterator;
|
||||
std::string s;
|
||||
@ -321,7 +323,7 @@ struct hash<ue2::ue2_literal::elem> {
|
||||
template<>
|
||||
struct hash<ue2::ue2_literal> {
|
||||
size_t operator()(const ue2::ue2_literal &lit) const {
|
||||
return ue2::ue2_hasher()(lit);
|
||||
return lit.hash();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user