Fix unintended sign extension in compressed BSA hash generation

Which, however, never happens with non-ASCII characters
revert-6246b479
Alexei Kotov 1 year ago
parent a8119f3863
commit 353b06325e

@ -470,7 +470,11 @@ namespace Bsa
return 0;
std::replace(str.begin(), str.end(), '/', '\\');
Misc::StringUtils::lowerCaseInPlace(str);
uint64_t result = str[len - 1] | (len >= 3 ? (str[len - 2] << 8) : 0) | (len << 16) | (str[0] << 24);
uint64_t result = str[len - 1];
if (len >= 3)
result |= str[len - 2] << 8;
result |= len << 16;
result |= static_cast<uint32_t>(str[0] << 24);
if (len >= 4)
{
uint32_t hash = 0;

Loading…
Cancel
Save