| 176 | } |
| 177 | |
| 178 | int32_t ComputeUtf16HashFromModifiedUtf8(const char* utf8, size_t utf16_length) { |
| 179 | uint32_t hash = 0; |
| 180 | while (utf16_length != 0u) { |
| 181 | const uint32_t pair = GetUtf16FromUtf8(&utf8); |
| 182 | const uint16_t first = GetLeadingUtf16Char(pair); |
| 183 | hash = hash * 31 + first; |
| 184 | --utf16_length; |
| 185 | const uint16_t second = GetTrailingUtf16Char(pair); |
| 186 | if (second != 0) { |
| 187 | hash = hash * 31 + second; |
| 188 | DCHECK_NE(utf16_length, 0u); |
| 189 | --utf16_length; |
| 190 | } |
| 191 | } |
| 192 | return static_cast<int32_t>(hash); |
| 193 | } |
| 194 | |
| 195 | uint32_t ComputeModifiedUtf8Hash(const char* chars) { |
| 196 | uint32_t hash = 0; |
nothing calls this directly
no test coverage detected