Skip to content

Commit

Permalink
Update FNV1HashHelper.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Dec 24, 2024
1 parent dbb3d75 commit 570abc6
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ internal static class FNV_1aHashHelper
/// Computes a hash of the string using the FNV-1a algorithm.
/// Used by Roslyn.
/// </summary>
public static uint ComputeStringHash(string s)
{
uint num = 2166136261u;
int num2 = 0;
while (num2 < s.Length)
{
num = (s[num2] ^ num) * 16777619;
num2++;
}

return num;
}
public static uint ComputeStringHash(string input) =>
input.Aggregate(2166136261u, (current, ch) => (ch ^ current) * 16777619);
}

0 comments on commit 570abc6

Please sign in to comment.