Skip to content

Commit

Permalink
Made Helpers.HashCode.GetHashCodeByteArray unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus-kirk committed Jan 23, 2024
1 parent 466ce49 commit 126206f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Helpers/HashCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ public static class HashCode
{
public static int GetHashCodeByteArray(byte[] array)
{
var hashValue = 31;

foreach (var value in array)
unchecked
{
hashValue = (37 * hashValue) + value.GetHashCode();
}
var hashValue = 31;

return hashValue;
foreach (var value in array)
{
hashValue = (37 * hashValue) + value.GetHashCode();
}

return hashValue;
}
}
}

0 comments on commit 126206f

Please sign in to comment.