Skip to content

Commit

Permalink
Fix Xxh64 lowercasing
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshadow565 committed Mar 28, 2023
1 parent 9784412 commit 8f90c5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cslol-tools/lib/lol/hash/xxh64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
using namespace lol;
using namespace lol::hash;

Xxh64::Xxh64(std::string_view str) noexcept : value_(XXH64(str.data(), str.size(), 0)) {}
Xxh64::Xxh64(std::string_view str) noexcept {
XXH64_state_t state;
XXH64_reset(&state, 0);
for (std::uint8_t c: str) {
c = c >= 'A' && c <= 'Z' ? (c - 'A') + 'a' : c;
XXH64_update(&state, (char const*)&c, 1);
}
value_ = XXH64_digest(&state);
}

auto Xxh64::from_path(std::string_view str) noexcept -> Xxh64 {
while (str.starts_with('.') || str.starts_with('/')) str.remove_prefix(1);
Expand Down

0 comments on commit 8f90c5d

Please sign in to comment.