Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Read*To* to improve operation dependency graph. #4746

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/hashing.h
Original file line number Diff line number Diff line change
Expand Up @@ -703,15 +703,15 @@ inline auto Hasher::Read1To3(const std::byte* data, ssize_t size) -> uint64_t {
uint64_t byte0 = static_cast<uint8_t>(data[0]);
uint64_t byte1 = static_cast<uint8_t>(data[size - 1]);
uint64_t byte2 = static_cast<uint8_t>(data[size >> 1]);
return byte0 | (byte1 << 16) | (byte2 << 8);
return (byte0 << 8) | (byte1 << 16) | byte2;
}

inline auto Hasher::Read4To8(const std::byte* data, ssize_t size) -> uint64_t {
uint32_t low;
std::memcpy(&low, data, sizeof(low));
uint32_t high;
std::memcpy(&high, data + size - sizeof(high), sizeof(high));
return low | (static_cast<uint64_t>(high) << 32);
return (static_cast<uint64_t>(low) << 32) | high;
}

inline auto Hasher::Read8To16(const std::byte* data, ssize_t size)
Expand Down
Loading