Files
2026-05-08 11:01:12 +02:00

46 lines
1.3 KiB
C#
Executable File

using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace JCIL.Core;
[SuppressMessage("ReSharper", "InconsistentNaming")]
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;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static bool ICmpGe(int a, int b)
{
return a >= b;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public static bool ICmpLe(int a, int b)
{
return a <= b;
}
}