Files
JCIL/JCIL.Core/ILHelpers.cs
T
2026-05-06 18:13:53 +02:00

32 lines
917 B
C#
Executable File

using System.Runtime.CompilerServices;
namespace JCIL.Core;
public static class ILHelpers
{
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static int LCmp(long a, long b)
{
if (a > b) return 1;
if (a < b) return -1;
return 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static int FCmpL(float a, float b)
{
if (float.IsNaN(a) || float.IsNaN(b)) return -1;
if (a > b) return 1;
if (a < b) return -1;
return 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static int FCmpG(float a, float b)
{
if (float.IsNaN(a) || float.IsNaN(b)) return 1;
if (a > b) return 1;
if (a < b) return -1;
return 0;
}
}