Class BitwiseComparer<T>
Represents bitwise comparer for the arbitrary value type.
Implements
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public sealed class BitwiseComparer<T> : IEqualityComparer<T>, IComparer<T> where T : struct
Type Parameters
Name | Description |
---|---|
T | The value type. |
Properties
| Improve this Doc View SourceInstance
Gets instance of this comparer.
Declaration
public static BitwiseComparer<T> Instance { get; }
Property Value
Type | Description |
---|---|
BitwiseComparer<T> | The instance of this comparer. |
Remarks
Use this property only if you need object implementing
Methods
| Improve this Doc View SourceCompare<G>(T, G)
Compares bits of two values of the different type.
Declaration
public static int Compare<G>(T first, G second)
where G : struct
Parameters
Type | Name | Description |
---|---|---|
T | first | The first value to compare. |
G | second | The second value to compare. |
Returns
Type | Description |
---|---|
Int32 | A value that indicates the relative order of the objects being compared. |
Type Parameters
Name | Description |
---|---|
G | Type of the second value. |
Equals<G>(T, G)
Checks bitwise equality between two values of different value types.
Declaration
public static bool Equals<G>(T first, G second)
where G : struct
Parameters
Type | Name | Description |
---|---|---|
T | first | The first value to check. |
G | second | The second value to check. |
Returns
Type | Description |
---|---|
Boolean | true, if both values are equal; otherwise, false. |
Type Parameters
Name | Description |
---|---|
G | Type of second value. |
Remarks
This method doesn't use
GetHashCode(T, Boolean)
Computes hash code for the structure content.
Declaration
public static int GetHashCode(T value, bool salted = true)
Parameters
Type | Name | Description |
---|---|---|
T | value | Value to be hashed. |
Boolean | salted | true to include randomized salt data into hashing; false to use data from memory only. |
Returns
Type | Description |
---|---|
Int32 | Content hash code. |
GetHashCode(T, Int32, Func<Int32, Int32, Int32>, Boolean)
Computes bitwise hash code for the specified value.
Declaration
public static int GetHashCode(T value, int hash, Func<int, int, int> hashFunction, bool salted = true)
Parameters
Type | Name | Description |
---|---|---|
T | value | A value to be hashed. |
Int32 | hash | Initial value of the hash. |
DotNext.Func<Int32, Int32, Int32> | hashFunction | Hashing function. |
Boolean | salted | true to include randomized salt data into hashing; false to use data from memory only. |
Returns
Type | Description |
---|---|
Int32 | Bitwise hash code. |
Remarks
This method doesn't use
GetHashCode(T, Int32, ValueFunc<Int32, Int32, Int32>, Boolean)
Computes bitwise hash code for the specified value.
Declaration
public static int GetHashCode(T value, int hash, in ValueFunc<int, int, int> hashFunction, bool salted = true)
Parameters
Type | Name | Description |
---|---|---|
T | value | A value to be hashed. |
Int32 | hash | Initial value of the hash. |
ValueFunc<Int32, Int32, Int32> | hashFunction | Hashing function. |
Boolean | salted | true to include randomized salt data into hashing; false to use data from memory only. |
Returns
Type | Description |
---|---|
Int32 | Bitwise hash code. |
Remarks
This method doesn't use