Skip to content

MurmurHash3 Bugfix#1864

Merged
vazois merged 2 commits into
microsoft:mainfrom
chenhao-ye:bugfix-MurmurHash3x64A
Jun 8, 2026
Merged

MurmurHash3 Bugfix#1864
vazois merged 2 commits into
microsoft:mainfrom
chenhao-ye:bugfix-MurmurHash3x64A

Conversation

@chenhao-ye

Copy link
Copy Markdown
Contributor

This PR fixes two existing bugs in MurmurHash3:

  • MurmurHash3x64A computes suffixLen incorrectly: it should be len & 7 instead of len & 15.
  • Bitshift should be applied after casting to ulong. Otherwise, the int default cannot be shifted by up to 48 bits.

Copilot AI review requested due to automatic review settings June 8, 2026 17:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates MurmurHash3 tail-byte handling in HashUtils.cs, primarily by adjusting suffix length computation in the x64A variant and fixing incorrect 64-bit shifts by casting to ulong before shifting.

Changes:

  • Adjusted tail length mask in MurmurHash3x64A from len & 15 to len & 7.
  • Fixed tail-byte shifting by casting to ulong before left shifts in both MurmurHash3x64A and MurmurHash3x128.

Comment thread libs/common/HashUtils.cs
Comment thread libs/common/HashUtils.cs
Comment thread libs/common/HashUtils.cs
@vazois vazois merged commit ade916b into microsoft:main Jun 8, 2026
145 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants