We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 82ba44f commit 4d01833Copy full SHA for 4d01833
1 file changed
src/base/small_string_map.cc
@@ -38,16 +38,16 @@ small_string_map::lookup(const string_fragment& in)
38
return std::nullopt;
39
}
40
41
- alignas(8) char in_key[MAX_KEY_SIZE]{};
42
- memcpy(in_key, in.data(), in.length());
43
-
44
auto index = this->ssm_start_index;
45
for (int lpc = 0; lpc < MAP_SIZE; ++lpc) {
46
- if (memcmp(&this->ssm_keys[index * MAX_KEY_SIZE], in_key, MAX_KEY_SIZE)
47
- == 0)
+ if (memcmp(
+ &this->ssm_keys[index * MAX_KEY_SIZE], in.data(), in.length())
+ == 0
+ && (in.length() == MAX_KEY_SIZE
+ || this->ssm_keys[index * MAX_KEY_SIZE + in.length()] == '\0'))
48
{
49
this->ssm_start_index = index;
50
- return index;
+ return this->ssm_values[index];
51
52
index = (index + 1) % MAP_SIZE;
53
0 commit comments