diff --git a/build/props/common.props b/build/props/common.props index 44a1d708ca..814c097424 100644 --- a/build/props/common.props +++ b/build/props/common.props @@ -150,25 +150,4 @@ - - - - - - - - - - - - - - - - - diff --git a/src/Maths/Silk.NET.Maths/Scalar.As.cs b/src/Maths/Silk.NET.Maths/Scalar.As.cs index 077f4a2239..44102d0476 100644 --- a/src/Maths/Silk.NET.Maths/Scalar.As.cs +++ b/src/Maths/Silk.NET.Maths/Scalar.As.cs @@ -44,2172 +44,6 @@ public partial class Scalar [MethodImpl(MaxOpt)] public static TTo As(TFrom val) where TFrom : notnull where TTo : notnull { - // We rejigged this code a bit to be a bit more strategic about its specialization branch as to not - // exceed RyuJIT's inlining/codegen budgets. In doing this, Mono apparently started producing invalid - // arm assembly, so we now maintain two paths: one for Mono, and one for CoreCLR. The CoreCLR one should - // really be preferred. -#if ANDROID || IOS - - return FromHalfToHalf(val); - - - [MethodImpl(MaxOpt)] - static TTo FromHalfToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (Half) (object) val; - } - - return FromHalfToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (Half) (object) val; - } - - return FromHalfToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (Half) (object) val; - } - - return FromHalfToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (float) (Half) (object) val; - } - - return FromHalfToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (Half) (object) val; - } - - return FromHalfToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToByte(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (Half) (object) val; - } - - return FromHalfToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToShort(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (Half) (object) val; - } - - return FromHalfToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (Half) (object) val; - } - - return FromHalfToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToInt(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (Half) (object) val; - } - - return FromHalfToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (Half) (object) val; - } - - return FromHalfToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToLong(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (Half) (object) val; - } - - return FromHalfToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToULong(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (Half) (object) val; - } - - return FromHalfToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (float) (Half) (object) val; - } - - return FromHalfToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromHalfToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(Half) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (float) (Half) (object) val; - } - - return FromFloatToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (float) (object) val; - } - - return FromFloatToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (float) (object) val; - } - - return FromFloatToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (float) (object) val; - } - - return FromFloatToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (float) (object) val; - } - - return FromFloatToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (float) (object) val; - } - - return FromFloatToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToByte(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (float) (object) val; - } - - return FromFloatToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToShort(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (float) (object) val; - } - - return FromFloatToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (float) (object) val; - } - - return FromFloatToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToInt(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (float) (object) val; - } - - return FromFloatToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (float) (object) val; - } - - return FromFloatToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToLong(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (float) (object) val; - } - - return FromFloatToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToULong(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (float) (object) val; - } - - return FromFloatToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (float) (object) val; - } - - return FromFloatToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromFloatToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(float) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (float) (object) val; - } - - return FromDoubleToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (double) (object) val; - } - - return FromDoubleToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (double) (object) val; - } - - return FromDoubleToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (double) (object) val; - } - - return FromDoubleToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (double) (object) val; - } - - return FromDoubleToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (double) (object) val; - } - - return FromDoubleToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToByte(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (double) (object) val; - } - - return FromDoubleToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToShort(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (double) (object) val; - } - - return FromDoubleToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (double) (object) val; - } - - return FromDoubleToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToInt(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (double) (object) val; - } - - return FromDoubleToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (double) (object) val; - } - - return FromDoubleToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToLong(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (double) (object) val; - } - - return FromDoubleToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToULong(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (double) (object) val; - } - - return FromDoubleToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (double) (object) val; - } - - return FromDoubleToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDoubleToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(double) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (double) (object) val; - } - - return FromDecimalToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (double) (decimal) (object) val; - } - - return FromDecimalToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (decimal) (object) val; - } - - return FromDecimalToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (decimal) (object) val; - } - - return FromDecimalToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (decimal) (object) val; - } - - return FromDecimalToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (decimal) (object) val; - } - - return FromDecimalToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToByte(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (decimal) (object) val; - } - - return FromDecimalToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToShort(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (decimal) (object) val; - } - - return FromDecimalToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (decimal) (object) val; - } - - return FromDecimalToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToInt(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (decimal) (object) val; - } - - return FromDecimalToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (decimal) (object) val; - } - - return FromDecimalToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToLong(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (decimal) (object) val; - } - - return FromDecimalToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToULong(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (decimal) (object) val; - } - - return FromDecimalToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (decimal) (object) val; - } - - return FromDecimalToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromDecimalToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(decimal) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (decimal) (object) val; - } - - return FromSByteToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (sbyte) (object) val; - } - - return FromSByteToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (sbyte) (object) val; - } - - return FromSByteToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (sbyte) (object) val; - } - - return FromSByteToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (sbyte) (object) val; - } - - return FromSByteToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (sbyte) (object) val; - } - - return FromSByteToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToByte(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (sbyte) (object) val; - } - - return FromSByteToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToShort(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (sbyte) (object) val; - } - - return FromSByteToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (sbyte) (object) val; - } - - return FromSByteToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToInt(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (sbyte) (object) val; - } - - return FromSByteToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (sbyte) (object) val; - } - - return FromSByteToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToLong(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (sbyte) (object) val; - } - - return FromSByteToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToULong(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (sbyte) (object) val; - } - - return FromSByteToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (sbyte) (object) val; - } - - return FromSByteToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromSByteToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(sbyte) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (sbyte) (object) val; - } - - return FromByteToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (byte) (object) val; - } - - return FromByteToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (byte) (object) val; - } - - return FromByteToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (byte) (object) val; - } - - return FromByteToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (byte) (object) val; - } - - return FromByteToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (byte) (object) val; - } - - return FromByteToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToByte(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (byte) (object) val; - } - - return FromByteToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToShort(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (byte) (object) val; - } - - return FromByteToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (byte) (object) val; - } - - return FromByteToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToInt(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (byte) (object) val; - } - - return FromByteToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (byte) (object) val; - } - - return FromByteToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToLong(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (byte) (object) val; - } - - return FromByteToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToULong(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (byte) (object) val; - } - - return FromByteToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (byte) (object) val; - } - - return FromByteToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromByteToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(byte) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (byte) (object) val; - } - - return FromShortToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (short) (object) val; - } - - return FromShortToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (short) (object) val; - } - - return FromShortToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (short) (object) val; - } - - return FromShortToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (short) (object) val; - } - - return FromShortToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (short) (object) val; - } - - return FromShortToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToByte(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (short) (object) val; - } - - return FromShortToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToShort(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (short) (object) val; - } - - return FromShortToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (short) (object) val; - } - - return FromShortToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToInt(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (short) (object) val; - } - - return FromShortToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (short) (object) val; - } - - return FromShortToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToLong(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (short) (object) val; - } - - return FromShortToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToULong(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (short) (object) val; - } - - return FromShortToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (short) (object) val; - } - - return FromShortToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromShortToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(short) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (short) (object) val; - } - - return FromUShortToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (ushort) (object) val; - } - - return FromUShortToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (ushort) (object) val; - } - - return FromUShortToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (ushort) (object) val; - } - - return FromUShortToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (ushort) (object) val; - } - - return FromUShortToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (ushort) (object) val; - } - - return FromUShortToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToByte(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (ushort) (object) val; - } - - return FromUShortToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToShort(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (ushort) (object) val; - } - - return FromUShortToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (ushort) (object) val; - } - - return FromUShortToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToInt(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (ushort) (object) val; - } - - return FromUShortToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (ushort) (object) val; - } - - return FromUShortToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToLong(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (ushort) (object) val; - } - - return FromUShortToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToULong(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (ushort) (object) val; - } - - return FromUShortToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (ushort) (object) val; - } - - return FromUShortToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUShortToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(ushort) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (ushort) (object) val; - } - - return FromIntToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (int) (object) val; - } - - return FromIntToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (int) (object) val; - } - - return FromIntToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (int) (object) val; - } - - return FromIntToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (int) (object) val; - } - - return FromIntToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (int) (object) val; - } - - return FromIntToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToByte(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (int) (object) val; - } - - return FromIntToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToShort(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (int) (object) val; - } - - return FromIntToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (int) (object) val; - } - - return FromIntToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToInt(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (int) (object) val; - } - - return FromIntToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (int) (object) val; - } - - return FromIntToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToLong(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (int) (object) val; - } - - return FromIntToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToULong(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (int) (object) val; - } - - return FromIntToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (int) (object) val; - } - - return FromIntToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromIntToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(int) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (int) (object) val; - } - - return FromUIntToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (uint) (object) val; - } - - return FromUIntToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (uint) (object) val; - } - - return FromUIntToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (uint) (object) val; - } - - return FromUIntToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (uint) (object) val; - } - - return FromUIntToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (uint) (object) val; - } - - return FromUIntToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToByte(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (uint) (object) val; - } - - return FromUIntToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToShort(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (uint) (object) val; - } - - return FromUIntToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (uint) (object) val; - } - - return FromUIntToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToInt(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (uint) (object) val; - } - - return FromUIntToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (uint) (object) val; - } - - return FromUIntToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToLong(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (uint) (object) val; - } - - return FromUIntToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToULong(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (uint) (object) val; - } - - return FromUIntToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (uint) (object) val; - } - - return FromUIntToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromUIntToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(uint) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (uint) (object) val; - } - - return FromLongToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (long) (object) val; - } - - return FromLongToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (long) (object) val; - } - - return FromLongToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (long) (object) val; - } - - return FromLongToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (long) (object) val; - } - - return FromLongToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (long) (object) val; - } - - return FromLongToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToByte(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (long) (object) val; - } - - return FromLongToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToShort(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (long) (object) val; - } - - return FromLongToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (long) (object) val; - } - - return FromLongToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToInt(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (long) (object) val; - } - - return FromLongToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (long) (object) val; - } - - return FromLongToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToLong(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (long) (object) val; - } - - return FromLongToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToULong(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (long) (object) val; - } - - return FromLongToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (long) (object) val; - } - - return FromLongToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromLongToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(long) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (long) (object) val; - } - - return FromULongToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (ulong) (object) val; - } - - return FromULongToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (ulong) (object) val; - } - - return FromULongToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (ulong) (object) val; - } - - return FromULongToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (ulong) (object) val; - } - - return FromULongToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (ulong) (object) val; - } - - return FromULongToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToByte(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (ulong) (object) val; - } - - return FromULongToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToShort(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (ulong) (object) val; - } - - return FromULongToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (ulong) (object) val; - } - - return FromULongToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToInt(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (ulong) (object) val; - } - - return FromULongToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (ulong) (object) val; - } - - return FromULongToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToLong(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (ulong) (object) val; - } - - return FromULongToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToULong(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (ulong) (object) val; - } - - return FromULongToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (ulong) (object) val; - } - - return FromULongToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromULongToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(ulong) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (ulong) (object) val; - } - - return FromComplexToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (double) ((Complex) (object) val).Real; - } - - return FromComplexToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) ((Complex) (object) val).Real; - } - - return FromComplexToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) ((Complex) (object) val).Real; - } - - return FromComplexToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) ((Complex) (object) val).Real; - } - - return FromComplexToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) ((Complex) (object) val).Real; - } - - return FromComplexToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToByte(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) ((Complex) (object) val).Real; - } - - return FromComplexToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToShort(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) ((Complex) (object) val).Real; - } - - return FromComplexToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) ((Complex) (object) val).Real; - } - - return FromComplexToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToInt(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) ((Complex) (object) val).Real; - } - - return FromComplexToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) ((Complex) (object) val).Real; - } - - return FromComplexToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToLong(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) ((Complex) (object) val).Real; - } - - return FromComplexToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToULong(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) ((Complex) (object) val).Real; - } - - return FromComplexToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) ((Complex) (object) val).Real; - } - - return FromComplexToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromComplexToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(Complex) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) ((Complex) (object) val).Real; - } - - return FromBigIntegerToHalf(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToHalf(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(Half)) - { - return (TTo) (object) (Half) (double) (BigInteger) (object) val; - } - - return FromBigIntegerToFloat(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToFloat(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(float)) - { - return (TTo) (object) (float) (BigInteger) (object) val; - } - - return FromBigIntegerToDouble(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToDouble(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(double)) - { - return (TTo) (object) (double) (BigInteger) (object) val; - } - - return FromBigIntegerToDecimal(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToDecimal(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(decimal)) - { - return (TTo) (object) (decimal) (BigInteger) (object) val; - } - - return FromBigIntegerToSByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToSByte(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(sbyte)) - { - return (TTo) (object) (sbyte) (BigInteger) (object) val; - } - - return FromBigIntegerToByte(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToByte(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(byte)) - { - return (TTo) (object) (byte) (BigInteger) (object) val; - } - - return FromBigIntegerToShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToShort(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(short)) - { - return (TTo) (object) (short) (BigInteger) (object) val; - } - - return FromBigIntegerToUShort(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToUShort(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(ushort)) - { - return (TTo) (object) (ushort) (BigInteger) (object) val; - } - - return FromBigIntegerToInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToInt(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(int)) - { - return (TTo) (object) (int) (BigInteger) (object) val; - } - - return FromBigIntegerToUInt(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToUInt(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(uint)) - { - return (TTo) (object) (uint) (BigInteger) (object) val; - } - - return FromBigIntegerToLong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToLong(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(long)) - { - return (TTo) (object) (long) (BigInteger) (object) val; - } - - return FromBigIntegerToULong(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToULong(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(ulong)) - { - return (TTo) (object) (ulong) (BigInteger) (object) val; - } - - return FromBigIntegerToComplex(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToComplex(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(Complex)) - { - return (TTo) (object) (Complex) (BigInteger) (object) val; - } - - return FromBigIntegerToBigInteger(val); - } - - [MethodImpl(MaxOpt)] - static TTo FromBigIntegerToBigInteger(TFrom val) - { - if (typeof(TFrom) == typeof(BigInteger) && typeof(TTo) == typeof(BigInteger)) - { - return (TTo) (object) (BigInteger) (BigInteger) (object) val; - } - - ThrowUnsupportedType(); - return default!; - } -#else if (typeof(TFrom) == typeof(Half)) { return FromHalf((Half) (object) val); @@ -3178,7 +1012,6 @@ static TTo FromBigInteger(BigInteger val) ThrowUnsupportedType(); return default!; -#endif } } } \ No newline at end of file