Merge "use std::hash instead of hashing byte by byte"
This commit is contained in:
commit
aaa0bbce8e
1 changed files with 6 additions and 0 deletions
|
|
@ -100,6 +100,11 @@ static uint32_t RoundUpPower2(uint32_t val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t ComputeHash(const ZipString& name) {
|
static uint32_t ComputeHash(const ZipString& name) {
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
return std::hash<std::string_view>{}(
|
||||||
|
std::string_view(reinterpret_cast<const char*>(name.name), name.name_length));
|
||||||
|
#else
|
||||||
|
// Remove this code path once the windows compiler knows how to compile the above statement.
|
||||||
uint32_t hash = 0;
|
uint32_t hash = 0;
|
||||||
uint16_t len = name.name_length;
|
uint16_t len = name.name_length;
|
||||||
const uint8_t* str = name.name;
|
const uint8_t* str = name.name;
|
||||||
|
|
@ -109,6 +114,7 @@ static uint32_t ComputeHash(const ZipString& name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue