Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Hash.cs
Go to the documentation of this file.
2
4
5internal static class Hash
6{
7 internal const int FnvOffsetBias = -2128831035;
8
9 internal const int FnvPrime = 16777619;
10
11 internal static int Combine(int newKey, int currentKey)
12 {
13 return currentKey * -1521134295 + newKey;
14 }
15
16 internal static int Combine(uint newKey, int currentKey)
17 {
18 return currentKey * -1521134295 + (int)newKey;
19 }
20
21 internal static int Combine(bool newKeyPart, int currentKey)
22 {
23 return Combine(currentKey, newKeyPart ? 1 : 0);
24 }
25
26 internal static int GetFNVHashCode(byte[] data)
27 {
28 int num = -2128831035;
29 for (int i = 0; i < data.Length; i++)
30 {
31 num = (num ^ data[i]) * 16777619;
32 }
33 return num;
34 }
35
36 internal static int GetFNVHashCode(ImmutableArray<byte> data)
37 {
38 int num = -2128831035;
39 for (int i = 0; i < data.Length; i++)
40 {
41 num = (num ^ data[i]) * 16777619;
42 }
43 return num;
44 }
45}
static int GetFNVHashCode(ImmutableArray< byte > data)
Definition Hash.cs:36
static int GetFNVHashCode(byte[] data)
Definition Hash.cs:26
static int Combine(uint newKey, int currentKey)
Definition Hash.cs:16
static int Combine(bool newKeyPart, int currentKey)
Definition Hash.cs:21
static int Combine(int newKey, int currentKey)
Definition Hash.cs:11