removed hashSize global | bench 1857933
This commit is contained in:
1 parent
8ca878275a
commit
3aad0d90ee
3 files changed
+7
-8
No files matched your search
+4
-5
@@ -21,27 +21,26 @@ constexpr U64 maxHash = (64* 1000000) / sizeof(TTEntry);
|
||||
// 5 MB
|
||||
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
|
||||
|
||||
inline U64 hashSize = defaultHash;
|
||||
|
||||
constexpr int invalidEntry = 111111;
|
||||
|
||||
class TTable {
|
||||
private:
|
||||
std::vector<TTEntry> table;
|
||||
public:
|
||||
TTable() : table(hashSize) {};
|
||||
TTable() : table(defaultHash) {};
|
||||
|
||||
void Resize(U64 size) {
|
||||
table.resize(size);
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
U64 size = table.size();
|
||||
table.clear();
|
||||
table.resize(hashSize);
|
||||
table.resize(size);
|
||||
}
|
||||
|
||||
TTEntry* GetRawEntry(U64 &hashKey) {
|
||||
TTEntry *current = &table[hashKey % hashSize];
|
||||
TTEntry *current = &table[hashKey % table.size()];
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user