Struct XxHash32
Incremental hash builder implementing xxHash32, used internally to compute expression and query plan hashes.
public struct XxHash32
- Inherited Members
- Extension Methods
Remarks
Named after the algorithm so it does not collide with HashCode. Algorithm reference: https://github.com/Cyan4973/xxHash
Methods
Add(int)
Adds a 32-bit integer to the running hash code.
public void Add(int value)
Parameters
valueintThe value to add.
AddBytes(ReadOnlySpan<byte>)
Adds a span of bytes to the hash code.
public void AddBytes(ReadOnlySpan<byte> value)
Parameters
valueReadOnlySpan<byte>The span.
Remarks
This method does not guarantee that the result of adding a span of bytes will match the result of adding the same bytes individually.
Add<T>(T?)
Adds a value to the running hash code.
public void Add<T>(T? value)
Parameters
valueTThe value to add; a
nullreference contributes zero.
Type Parameters
TThe type of the value.
Add<T>(T?, IEqualityComparer<T?>?)
Adds a value to the running hash code, computing its hash with the supplied comparer.
public void Add<T>(T? value, IEqualityComparer<T?>? comparer)
Parameters
valueTThe value to add; a
nullreference contributes zero.comparerIEqualityComparer<T>The comparer used to hash
value, ornullto use the value's own hash code.
Type Parameters
TThe type of the value.
Combine<T1>(T1)
Combines the hash code of a single value into a 32-bit hash code.
public static int Combine<T1>(T1 value1)
Parameters
value1T1The value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the value.
Combine<T1, T2>(T1, T2)
Combines the hash codes of two values into a single 32-bit hash code.
public static int Combine<T1, T2>(T1 value1, T2 value2)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
Combine<T1, T2, T3>(T1, T2, T3)
Combines the hash codes of three values into a single 32-bit hash code.
public static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
value3T3The third value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
Combine<T1, T2, T3, T4>(T1, T2, T3, T4)
Combines the hash codes of four values into a single 32-bit hash code.
public static int Combine<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
value3T3The third value to include in the hash.
value4T4The fourth value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
T4The type of the fourth value.
Combine<T1, T2, T3, T4, T5>(T1, T2, T3, T4, T5)
Combines the hash codes of five values into a single 32-bit hash code.
public static int Combine<T1, T2, T3, T4, T5>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
value3T3The third value to include in the hash.
value4T4The fourth value to include in the hash.
value5T5The fifth value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
T4The type of the fourth value.
T5The type of the fifth value.
Combine<T1, T2, T3, T4, T5, T6>(T1, T2, T3, T4, T5, T6)
Combines the hash codes of six values into a single 32-bit hash code.
public static int Combine<T1, T2, T3, T4, T5, T6>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
value3T3The third value to include in the hash.
value4T4The fourth value to include in the hash.
value5T5The fifth value to include in the hash.
value6T6The sixth value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
T4The type of the fourth value.
T5The type of the fifth value.
T6The type of the sixth value.
Combine<T1, T2, T3, T4, T5, T6, T7>(T1, T2, T3, T4, T5, T6, T7)
Combines the hash codes of seven values into a single 32-bit hash code.
public static int Combine<T1, T2, T3, T4, T5, T6, T7>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
value3T3The third value to include in the hash.
value4T4The fourth value to include in the hash.
value5T5The fifth value to include in the hash.
value6T6The sixth value to include in the hash.
value7T7The seventh value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
T4The type of the fourth value.
T5The type of the fifth value.
T6The type of the sixth value.
T7The type of the seventh value.
Combine<T1, T2, T3, T4, T5, T6, T7, T8>(T1, T2, T3, T4, T5, T6, T7, T8)
Combines the hash codes of eight values into a single 32-bit hash code.
public static int Combine<T1, T2, T3, T4, T5, T6, T7, T8>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
Parameters
value1T1The first value to include in the hash.
value2T2The second value to include in the hash.
value3T3The third value to include in the hash.
value4T4The fourth value to include in the hash.
value5T5The fifth value to include in the hash.
value6T6The sixth value to include in the hash.
value7T7The seventh value to include in the hash.
value8T8The eighth value to include in the hash.
Returns
- int
The combined hash code.
Type Parameters
T1The type of the first value.
T2The type of the second value.
T3The type of the third value.
T4The type of the fourth value.
T5The type of the fifth value.
T6The type of the sixth value.
T7The type of the seventh value.
T8The type of the eighth value.
ToHashCode()
Computes the final 32-bit hash code from the values added so far.
public int ToHashCode()
Returns
- int
The xxHash32 hash code.