diff options
author | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/generic/hash.cpp |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/generic/hash.cpp')
-rw-r--r-- | util/generic/hash.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/util/generic/hash.cpp b/util/generic/hash.cpp new file mode 100644 index 00000000000..a674ee4538a --- /dev/null +++ b/util/generic/hash.cpp @@ -0,0 +1,51 @@ +#include "hash.h" + +#include <util/string/escape.h> +#include <util/string/cast.h> + +const void* const _yhashtable_empty_data[] = {(void*)3, nullptr, (void*)1}; + +TString NPrivate::MapKeyToString(TStringBuf key) { + constexpr size_t HASH_KEY_MAX_LENGTH = 500; + try { + return EscapeC(key.substr(0, HASH_KEY_MAX_LENGTH)); + } catch (...) { + return "TStringBuf"; + } +} + +TString NPrivate::MapKeyToString(unsigned short key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(short key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(unsigned int key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(int key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(unsigned long key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(long key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(unsigned long long key) { + return ToString(key); +} + +TString NPrivate::MapKeyToString(long long key) { + return ToString(key); +} + +void NPrivate::ThrowKeyNotFoundInHashTableException(const TStringBuf keyRepresentation) { + ythrow yexception() << "Key not found in hashtable: " << keyRepresentation; +} |