| 100 | } |
| 101 | |
| 102 | static uint32_t ComputeHash(const ZipString& name) { |
| 103 | #if !defined(_WIN32) |
| 104 | return std::hash<std::string_view>{}( |
| 105 | std::string_view(reinterpret_cast<const char*>(name.name), name.name_length)); |
| 106 | #else |
| 107 | // Remove this code path once the windows compiler knows how to compile the above statement. |
| 108 | uint32_t hash = 0; |
| 109 | uint16_t len = name.name_length; |
| 110 | const uint8_t* str = name.name; |
| 111 | |
| 112 | while (len--) { |
| 113 | hash = hash * 31 + *str++; |
| 114 | } |
| 115 | |
| 116 | return hash; |
| 117 | #endif |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | * Convert a ZipEntry to a hash table index, verifying that it's in a |
no outgoing calls
no test coverage detected