/// <summary> /// Compares <paramref name="x"/> to <paramref name="y"/> without boxing the values. /// </summary> /// <param name="x">The first enum value.</param> /// <param name="y">The second enum value.</param> /// <returns>1 if <paramref name="x"/> is greater than <paramref name="y"/>, 0 if <paramref name="x"/> equals <paramref name="y"/>, /// and -1 if <paramref name="x"/> is less than <paramref name="y"/>.</returns> public int Compare(object?x, object?y) => x is object?(y is object?_enumCache.CompareTo(x, y) : 1) : (y is null ? 0 : -1);
/// <summary> /// Compares <paramref name="x"/> to <paramref name="y"/> without boxing the values. /// </summary> /// <param name="x">The first enum value.</param> /// <param name="y">The second enum value.</param> /// <returns>1 if <paramref name="x"/> is greater than <paramref name="y"/>, 0 if <paramref name="x"/> equals <paramref name="y"/>, /// and -1 if <paramref name="x"/> is less than <paramref name="y"/>.</returns> public int Compare(TEnum x, TEnum y) => s_cache.CompareTo(ref UnsafeUtility.As <TEnum, byte>(ref x), ref UnsafeUtility.As <TEnum, byte>(ref y));