Skip to content

Commit ad6ce30

Browse files
jdswczpernicekjamescrosswell
authored
Fix UWP Net Native compilation (#4085)
--------- Co-authored-by: Jan Drozd <info@jandrozd.eu> Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
1 parent a888dde commit ad6ce30

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixes
66

7+
- Fix UWP Net Native compilation ([#4085](https://github.com/getsentry/sentry-dotnet/pull/4085))
78
- Sentry Java SDK dependencies are now detected and included in the Android bindings ([#4079](https://github.com/getsentry/sentry-dotnet/pull/4079))
89

910
## 5.5.0

src/Sentry/Internal/FnvHash.cs

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,23 @@ namespace Sentry.Internal;
55
///
66
/// See https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV_hash_parameters
77
/// </summary>
8-
/// <remarks>
9-
/// We use a struct to avoid heap allocations.
10-
/// </remarks>
11-
internal struct FnvHash
8+
internal static class FnvHash
129
{
13-
public FnvHash()
14-
{
15-
}
16-
1710
private const int Offset = unchecked((int)2166136261);
1811
private const int Prime = 16777619;
1912

20-
private int HashCode { get; set; } = Offset;
21-
22-
private void Combine(byte data)
23-
{
24-
unchecked
25-
{
26-
HashCode ^= data;
27-
HashCode *= Prime;
28-
}
29-
}
30-
31-
private static int ComputeHash(byte[] data)
13+
internal static int ComputeHash(string input)
3214
{
33-
var result = new FnvHash();
34-
foreach (var b in data)
15+
var hashCode = Offset;
16+
foreach (var b in Encoding.UTF8.GetBytes(input))
3517
{
36-
result.Combine(b);
18+
unchecked
19+
{
20+
hashCode ^= b;
21+
hashCode *= Prime;
22+
}
3723
}
3824

39-
return result.HashCode;
25+
return hashCode;
4026
}
41-
42-
public static int ComputeHash(string data) => ComputeHash(Encoding.UTF8.GetBytes(data));
4327
}

0 commit comments

Comments
 (0)