| 289 | //////////////////////////////////////////////////////////////////////////////// |
| 290 | |
| 291 | size_t TCaseInsensitiveStringHasher::operator()(TStringBuf arg) const |
| 292 | { |
| 293 | auto compute = [&] (char* buffer) { |
| 294 | for (size_t index = 0; index < arg.length(); ++index) { |
| 295 | buffer[index] = AsciiToLower(arg[index]); |
| 296 | } |
| 297 | return ComputeHash(TStringBuf(buffer, arg.length())); |
| 298 | }; |
| 299 | const size_t SmallSize = 256; |
| 300 | if (arg.length() <= SmallSize) { |
| 301 | std::array<char, SmallSize> stackBuffer; |
| 302 | return compute(stackBuffer.data()); |
| 303 | } else { |
| 304 | std::unique_ptr<char[]> heapBuffer(new char[arg.length()]); |
| 305 | return compute(heapBuffer.get()); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | bool TCaseInsensitiveStringEqualComparer::operator()(TStringBuf lhs, TStringBuf rhs) const |
| 310 | { |
nothing calls this directly
no test coverage detected