Uh oh!
There was an error while loading. Please reload this page.
add named hash functors and delegate DefaultHash to them - #899
Merged
Conversation
FnvHash now owns the FNV-1a machinery (hashBytes, hashNulTerminated, hashIter) and hashes scalars, non-Unit pointers and strings. UnitHash and UnitNumberHash hash Units by their number, PtrIdentityHash casts a pointer's address to unsigned, LengthHash returns a container's length, PairHash<HashFst,HashSnd> combines the element hashes of a pair. Every dispatch branch of DefaultHash and DefaultHash2 is now a one-line delegation to one of these, so hash values are unchanged by construction and no call site changes yet. FnvHash and PtrIdentityHash reject Unit-derived pointers with a static_assert: once call sites name their hashes directly, a Unit key cannot silently get the pointer-bytes hash instead of the hash by unit number. tHash.cpp pins the FNV-1a reference vectors and the equality between the named functors and what DefaultHash/DefaultHash2 resolve to; the equality half leaves with DefaultHash at the end of the series. Part of vprover#898.
MichaelRawson
approved these changes
Aug 12, 2026
MichaelRawson
commented
Aug 12, 2026
Contributor
Nice - even if we don't end up completely removing |
Uh oh!
There was an error while loading. Please reload this page.
shalashaska117
commented
Aug 12, 2026
ContributorAuthor
It will be the last step deleting everything legacy, so that every step is not the default path meanwhile I continue developing each phases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First PR of the series in #898.
Adds named single-purpose hash functors to Lib/Hash.hpp: FnvHash (owns hashBytes/hashNulTerminated/hashIter and hashes scalars, non-Unit pointers and strings), UnitHash and UnitNumberHash (Units by their number), PtrIdentityHash (pointer address cast to unsigned), LengthHash (container length) and PairHash<HashFst,HashSnd>. Every dispatch branch of DefaultHash/DefaultHash2 is now a one-line delegation to one of these, so hash values are unchanged by construction and no call site changes yet.
FnvHash and PtrIdentityHash static_assert against Unit-derived pointers, so later stages cannot hand a Unit key the pointer-bytes hash by mistake.
A new unit test pins the FNV-1a reference vectors and the named-vs-DefaultHash equality; the equality half leaves with DefaultHash at the end of the series.
Tested: debug ctest 99/99, including the new Hash test.