Skip to content

Fix .NET 3.5 InternableString.GetHashCode to match the full implementation - #8340

Merged
JaynieBai merged 3 commits into
dotnet:mainfrom
ladipro:fix-netfx32-hash
Feb 6, 2023
Merged

JaynieBai merged 3 commits into
dotnet:mainfrom
ladipro:fix-netfx32-hash

Conversation

@ladipro

@ladipro ladipro commented Jan 23, 2023 •

Copy link
Copy Markdown
Member

Fixes part of 8329

Context

The 3.5 version of InternableString uses a simpler hash code calculation, the results of which were not matching the 4.72/Core version. This manifested as a failing unit test RetainsLastStringWithGivenHashCode in VS.

Changes Made

Made the routine return the same numbers as the other implementation. It fixed the UT and also made the hash code "better" as previously we were shifting instead of rotating bits.

Testing

Existing unit tests (previously failing).

Notes

It would be nice to figure out how to run 3.5 tests in CI.

@ladipro ladipro mentioned this pull request Jan 23, 2023
9 of 10 tasks
Comment thread src/StringTools/InternableString.Simple.cs
@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Jan 30, 2023
@JaynieBai
JaynieBai merged commit fc3ab4c into dotnet:main Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants