Here are the examples of the csharp api System.IComparable.CompareTo(TX) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
19
Source : VectorizedSort.cs
with MIT License
from damageboy
with MIT License
from damageboy
static unsafe void SwapIfGreater<TX>(TX *left, TX *right) where TX : unmanaged, IComparable<TX>
{
if ((*left).CompareTo(*right) <= 0) return;
Swap(left, right);
}
19
Source : VectorizedSort.cs
with MIT License
from damageboy
with MIT License
from damageboy
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static unsafe void InsertionSort<TX>(TX * left, TX * right) where TX : unmanaged, IComparable<TX>
{
for (var i = left; i < right; i++) {
var j = i;
var t = *(i + 1);
while (j >= left && t.CompareTo(*j) < 0) {
*(j + 1) = *j;
j--;
}
*(j + 1) = t;
}
}