docs(StringFnV1AHasher): replace tutorial-style loop comment - #295
Conversation
The inner-loop comment ("Convert char to its lower byte; you may also
want to consider encoding specifics if you deal with non-ASCII
characters") read as leftover second-person scaffolding. Replace it with
a declarative note describing the actual low-byte-only behavior and the
collision it implies, matching the comment style of sibling hashers such
as StringDjb2Hasher and StringFnV1AFullHasher.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates an inline comment in StringFnV1AHasher.Hash to be more declarative and consistent with the documentation style used across the hashing implementations in Celerity.Hashing.
Changes:
- Replaced the tutorial-style inner-loop comment with a declarative explanation of the “low-byte-only” folding behavior.
- Added an inline pointer to
StringFnV1AFullHasheras the full-width alternative.
Coverage
Files below 100% line coverage
|
Benchmarks5 regressions Highlights
Collections (396)
Hashers (100)
Same-runner A/B (sharded 6-way): main ( |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/Celerity.Hashing/StringFnV1AHasher.cs:41
- The comment mixes “UTF-16 code unit” (line 39) with “Characters” (line 39) and “high byte” wording (line 40). Since the loop processes UTF-16 code units (
foreach (char c ...)) and other hashers/docs in this repo consistently describe the “upper byte”, updating this comment keeps the documentation precise and consistent with the rest of the hashing implementations.
// Fold only the low byte of each UTF-16 code unit. Characters that share a
// low byte but differ in their high byte (i.e., U+0100 and above) collide here; use
// StringFnV1AFullHasher when that distinction matters.
What
Replaced a leftover tutorial-style comment in the
StringFnV1AHasher.Hashinner loop with a declarative one describing what the code actually does.Why
The old comment — "Convert char to its lower byte; you may also want to consider encoding specifics if you deal with non-ASCII characters" — is written in second person and reads like scaffolding left over from a tutorial. It is also out of step with the precise, declarative comments its sibling hashers carry for the same low-byte operation (e.g.
StringDjb2Hasher,StringFnV1AFullHasher), which state exactly what is folded and what collides. The replacement states the low-byte-only behavior and its collision implication and points atStringFnV1AFullHasherfor the full-width alternative.Comment-only change; no code or behavioral impact.
Test plan
dotnet build— succeeds, 0 errors