private string ValueToString()
{
ref byte data = ref this.GetRawData();
- switch (InternalGetCorElementType())
+ return (InternalGetCorElementType()) switch
{
- case CorElementType.ELEMENT_TYPE_I1:
- return Unsafe.As<byte, sbyte>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_U1:
- return data.ToString();
- case CorElementType.ELEMENT_TYPE_BOOLEAN:
- return Unsafe.As<byte, bool>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_I2:
- return Unsafe.As<byte, short>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_U2:
- return Unsafe.As<byte, ushort>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_CHAR:
- return Unsafe.As<byte, char>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_I4:
- return Unsafe.As<byte, int>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_U4:
- return Unsafe.As<byte, uint>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_R4:
- return Unsafe.As<byte, float>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_I8:
- return Unsafe.As<byte, long>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_U8:
- return Unsafe.As<byte, ulong>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_R8:
- return Unsafe.As<byte, double>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_I:
- return Unsafe.As<byte, IntPtr>(ref data).ToString();
- case CorElementType.ELEMENT_TYPE_U:
- return Unsafe.As<byte, UIntPtr>(ref data).ToString();
- default:
- throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
- }
+ CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_U1 => data.ToString(),
+ CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data).ToString(),
+ CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data).ToString(),
+ _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
+ };
}
private string ValueToHexString()
private static string ValueToHexString(object value)
{
- switch (Convert.GetTypeCode(value))
+ return (Convert.GetTypeCode(value)) switch
{
- case TypeCode.SByte:
- return ((byte)(sbyte)value).ToString("X2", null);
- case TypeCode.Byte:
- return ((byte)value).ToString("X2", null);
- case TypeCode.Boolean:
- // direct cast from bool to byte is not allowed
- return Convert.ToByte((bool)value).ToString("X2", null);
- case TypeCode.Int16:
- return ((ushort)(short)value).ToString("X4", null);
- case TypeCode.UInt16:
- return ((ushort)value).ToString("X4", null);
- case TypeCode.Char:
- return ((ushort)(char)value).ToString("X4", null);
- case TypeCode.UInt32:
- return ((uint)value).ToString("X8", null);
- case TypeCode.Int32:
- return ((uint)(int)value).ToString("X8", null);
- case TypeCode.UInt64:
- return ((ulong)value).ToString("X16", null);
- case TypeCode.Int64:
- return ((ulong)(long)value).ToString("X16", null);
- // All unsigned types will be directly cast
- default:
- throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
- }
+ TypeCode.SByte => ((byte)(sbyte)value).ToString("X2", null),
+ TypeCode.Byte => ((byte)value).ToString("X2", null),
+ TypeCode.Boolean => Convert.ToByte((bool)value).ToString("X2", null), // direct cast from bool to byte is not allowed
+ TypeCode.Int16 => ((ushort)(short)value).ToString("X4", null),
+ TypeCode.UInt16 => ((ushort)value).ToString("X4", null),
+ TypeCode.Char => ((ushort)(char)value).ToString("X4", null),
+ TypeCode.UInt32 => ((uint)value).ToString("X8", null),
+ TypeCode.Int32 => ((uint)(int)value).ToString("X8", null),
+ TypeCode.UInt64 => ((ulong)value).ToString("X16", null),
+ TypeCode.Int64 => ((ulong)(long)value).ToString("X16", null),
+ _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
+ };
}
internal static string? GetEnumName(RuntimeType enumType, ulong ulValue)
// Helper function to silently convert the value to UInt64 from the other base types for enum without throwing an exception.
// This is need since the Convert functions do overflow checks.
TypeCode typeCode = Convert.GetTypeCode(value);
-
- ulong result;
- switch (typeCode)
+ var result = typeCode switch
{
- case TypeCode.SByte:
- result = (ulong)(sbyte)value;
- break;
- case TypeCode.Byte:
- result = (byte)value;
- break;
- case TypeCode.Boolean:
- // direct cast from bool to byte is not allowed
- result = Convert.ToByte((bool)value);
- break;
- case TypeCode.Int16:
- result = (ulong)(short)value;
- break;
- case TypeCode.UInt16:
- result = (ushort)value;
- break;
- case TypeCode.Char:
- result = (ushort)(char)value;
- break;
- case TypeCode.UInt32:
- result = (uint)value;
- break;
- case TypeCode.Int32:
- result = (ulong)(int)value;
- break;
- case TypeCode.UInt64:
- result = (ulong)value;
- break;
- case TypeCode.Int64:
- result = (ulong)(long)value;
- break;
- // All unsigned types will be directly cast
- default:
- throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
- }
-
+ TypeCode.SByte => (ulong)(sbyte)value,
+ TypeCode.Byte => (byte)value,
+ TypeCode.Boolean => Convert.ToByte((bool)value), // direct cast from bool to byte is not allowed
+ TypeCode.Int16 => (ulong)(short)value,
+ TypeCode.UInt16 => (ushort)value,
+ TypeCode.Char => (ushort)(char)value,
+ TypeCode.UInt32 => (uint)value,
+ TypeCode.Int32 => (ulong)(int)value,
+ TypeCode.UInt64 => (ulong)value,
+ TypeCode.Int64 => (ulong)(long)value,
+ _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
+ };
return result;
}
// Delegate rest of error checking to the other functions
TypeCode typeCode = Convert.GetTypeCode(value);
- switch (typeCode)
+ return typeCode switch
{
- case TypeCode.Int32:
- return ToObject(enumType, (int)value);
-
- case TypeCode.SByte:
- return ToObject(enumType, (sbyte)value);
-
- case TypeCode.Int16:
- return ToObject(enumType, (short)value);
-
- case TypeCode.Int64:
- return ToObject(enumType, (long)value);
-
- case TypeCode.UInt32:
- return ToObject(enumType, (uint)value);
-
- case TypeCode.Byte:
- return ToObject(enumType, (byte)value);
-
- case TypeCode.UInt16:
- return ToObject(enumType, (ushort)value);
-
- case TypeCode.UInt64:
- return ToObject(enumType, (ulong)value);
-
- case TypeCode.Char:
- return ToObject(enumType, (char)value);
-
- case TypeCode.Boolean:
- return ToObject(enumType, (bool)value);
-
- default:
- // All unsigned types will be directly cast
- throw new ArgumentException(SR.Arg_MustBeEnumBaseTypeOrEnum, nameof(value));
- }
+ TypeCode.Int32 => ToObject(enumType, (int)value),
+ TypeCode.SByte => ToObject(enumType, (sbyte)value),
+ TypeCode.Int16 => ToObject(enumType, (short)value),
+ TypeCode.Int64 => ToObject(enumType, (long)value),
+ TypeCode.UInt32 => ToObject(enumType, (uint)value),
+ TypeCode.Byte => ToObject(enumType, (byte)value),
+ TypeCode.UInt16 => ToObject(enumType, (ushort)value),
+ TypeCode.UInt64 => ToObject(enumType, (ulong)value),
+ TypeCode.Char => ToObject(enumType, (char)value),
+ TypeCode.Boolean => ToObject(enumType, (bool)value),
+ _ => throw new ArgumentException(SR.Arg_MustBeEnumBaseTypeOrEnum, nameof(value)),
+ };
}
public static string Format(Type enumType, object value, string format)
internal object GetValue()
{
ref byte data = ref this.GetRawData();
- switch (InternalGetCorElementType())
+ return (InternalGetCorElementType()) switch
{
- case CorElementType.ELEMENT_TYPE_I1:
- return Unsafe.As<byte, sbyte>(ref data);
- case CorElementType.ELEMENT_TYPE_U1:
- return data;
- case CorElementType.ELEMENT_TYPE_BOOLEAN:
- return Unsafe.As<byte, bool>(ref data);
- case CorElementType.ELEMENT_TYPE_I2:
- return Unsafe.As<byte, short>(ref data);
- case CorElementType.ELEMENT_TYPE_U2:
- return Unsafe.As<byte, ushort>(ref data);
- case CorElementType.ELEMENT_TYPE_CHAR:
- return Unsafe.As<byte, char>(ref data);
- case CorElementType.ELEMENT_TYPE_I4:
- return Unsafe.As<byte, int>(ref data);
- case CorElementType.ELEMENT_TYPE_U4:
- return Unsafe.As<byte, uint>(ref data);
- case CorElementType.ELEMENT_TYPE_R4:
- return Unsafe.As<byte, float>(ref data);
- case CorElementType.ELEMENT_TYPE_I8:
- return Unsafe.As<byte, long>(ref data);
- case CorElementType.ELEMENT_TYPE_U8:
- return Unsafe.As<byte, ulong>(ref data);
- case CorElementType.ELEMENT_TYPE_R8:
- return Unsafe.As<byte, double>(ref data);
- case CorElementType.ELEMENT_TYPE_I:
- return Unsafe.As<byte, IntPtr>(ref data);
- case CorElementType.ELEMENT_TYPE_U:
- return Unsafe.As<byte, UIntPtr>(ref data);
- default:
- throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
- }
+ CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data),
+ CorElementType.ELEMENT_TYPE_U1 => data,
+ CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data),
+ CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data),
+ CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data),
+ CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data),
+ CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data),
+ CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data),
+ CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data),
+ CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data),
+ CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data),
+ CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data),
+ CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data),
+ CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data),
+ _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
+ };
}
private ulong ToUInt64()
// The runtime can bypass calls to Enum::GetHashCode and call the underlying type's GetHashCode directly
// to avoid boxing the enum.
ref byte data = ref this.GetRawData();
- switch (InternalGetCorElementType())
+ return (InternalGetCorElementType()) switch
{
- case CorElementType.ELEMENT_TYPE_I1:
- return Unsafe.As<byte, sbyte>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_U1:
- return data.GetHashCode();
- case CorElementType.ELEMENT_TYPE_BOOLEAN:
- return Unsafe.As<byte, bool>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_I2:
- return Unsafe.As<byte, short>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_U2:
- return Unsafe.As<byte, ushort>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_CHAR:
- return Unsafe.As<byte, char>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_I4:
- return Unsafe.As<byte, int>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_U4:
- return Unsafe.As<byte, uint>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_R4:
- return Unsafe.As<byte, float>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_I8:
- return Unsafe.As<byte, long>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_U8:
- return Unsafe.As<byte, ulong>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_R8:
- return Unsafe.As<byte, double>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_I:
- return Unsafe.As<byte, IntPtr>(ref data).GetHashCode();
- case CorElementType.ELEMENT_TYPE_U:
- return Unsafe.As<byte, UIntPtr>(ref data).GetHashCode();
- default:
- throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
- }
+ CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_U1 => data.GetHashCode(),
+ CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data).GetHashCode(),
+ CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data).GetHashCode(),
+ _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
+ };
}
public override string ToString()
#region IConvertible
public TypeCode GetTypeCode()
{
- switch (InternalGetCorElementType())
+ return (InternalGetCorElementType()) switch
{
- case CorElementType.ELEMENT_TYPE_I1:
- return TypeCode.SByte;
- case CorElementType.ELEMENT_TYPE_U1:
- return TypeCode.Byte;
- case CorElementType.ELEMENT_TYPE_BOOLEAN:
- return TypeCode.Boolean;
- case CorElementType.ELEMENT_TYPE_I2:
- return TypeCode.Int16;
- case CorElementType.ELEMENT_TYPE_U2:
- return TypeCode.UInt16;
- case CorElementType.ELEMENT_TYPE_CHAR:
- return TypeCode.Char;
- case CorElementType.ELEMENT_TYPE_I4:
- return TypeCode.Int32;
- case CorElementType.ELEMENT_TYPE_U4:
- return TypeCode.UInt32;
- case CorElementType.ELEMENT_TYPE_I8:
- return TypeCode.Int64;
- case CorElementType.ELEMENT_TYPE_U8:
- return TypeCode.UInt64;
- default:
- throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
- }
+ CorElementType.ELEMENT_TYPE_I1 => TypeCode.SByte,
+ CorElementType.ELEMENT_TYPE_U1 => TypeCode.Byte,
+ CorElementType.ELEMENT_TYPE_BOOLEAN => TypeCode.Boolean,
+ CorElementType.ELEMENT_TYPE_I2 => TypeCode.Int16,
+ CorElementType.ELEMENT_TYPE_U2 => TypeCode.UInt16,
+ CorElementType.ELEMENT_TYPE_CHAR => TypeCode.Char,
+ CorElementType.ELEMENT_TYPE_I4 => TypeCode.Int32,
+ CorElementType.ELEMENT_TYPE_U4 => TypeCode.UInt32,
+ CorElementType.ELEMENT_TYPE_I8 => TypeCode.Int64,
+ CorElementType.ELEMENT_TYPE_U8 => TypeCode.UInt64,
+ _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
+ };
}
bool IConvertible.ToBoolean(IFormatProvider? provider)
/// </summary>
public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i32gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128 _mm_i32gather_ps (float const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128d _mm_i32gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i64gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i64gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i64gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_i64gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128 _mm_i64gather_ps (float const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128d _mm_i64gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector256<int> GatherVector256(int* baseAddress, Vector256<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector256<uint> GatherVector256(uint* baseAddress, Vector256<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256 _mm256_i32gather_ps (float const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector256<float> GatherVector256(float* baseAddress, Vector256<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256d _mm256_i32gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// </summary>
public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector128<int> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm256_i64gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector256<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm256_i64gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector256<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_i64gather_epi64 (__int64 const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector256<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_i64gather_epi64 (__int64 const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector256<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128 _mm256_i64gather_ps (float const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector256<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector128(baseAddress, index, 1);
- case 2:
- return GatherVector128(baseAddress, index, 2);
- case 4:
- return GatherVector128(baseAddress, index, 4);
- case 8:
- return GatherVector128(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector128(baseAddress, index, 1),
+ 2 => GatherVector128(baseAddress, index, 2),
+ 4 => GatherVector128(baseAddress, index, 4),
+ 8 => GatherVector128(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256d _mm256_i64gather_pd (double const* base_addr, __m256i vindex, const int scale)
/// </summary>
public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector256<long> index, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherVector256(baseAddress, index, 1);
- case 2:
- return GatherVector256(baseAddress, index, 2);
- case 4:
- return GatherVector256(baseAddress, index, 4);
- case 8:
- return GatherVector256(baseAddress, index, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherVector256(baseAddress, index, 1),
+ 2 => GatherVector256(baseAddress, index, 2),
+ 4 => GatherVector256(baseAddress, index, 4),
+ 8 => GatherVector256(baseAddress, index, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// </summary>
public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<int> index, Vector128<int> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i32gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<int> index, Vector128<uint> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i32gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<int> index, Vector128<long> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i32gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<int> index, Vector128<ulong> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128 _mm_mask_i32gather_ps (__m128 src, float const* base_addr, __m128i vindex, __m128 mask, const int scale)
/// </summary>
public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<int> index, Vector128<float> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128d _mm_mask_i32gather_pd (__m128d src, double const* base_addr, __m128i vindex, __m128d mask, const int scale)
/// </summary>
public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<int> index, Vector128<double> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<long> index, Vector128<int> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<long> index, Vector128<uint> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i64gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<long> index, Vector128<long> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm_mask_i64gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<long> index, Vector128<ulong> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128 _mm_mask_i64gather_ps (__m128 src, float const* base_addr, __m128i vindex, __m128 mask, const int scale)
/// </summary>
public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<long> index, Vector128<float> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128d _mm_mask_i64gather_pd (__m128d src, double const* base_addr, __m128i vindex, __m128d mask, const int scale)
/// </summary>
public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<long> index, Vector128<double> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// </summary>
public static unsafe Vector256<int> GatherMaskVector256(Vector256<int> source, int* baseAddress, Vector256<int> index, Vector256<int> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// </summary>
public static unsafe Vector256<uint> GatherMaskVector256(Vector256<uint> source, uint* baseAddress, Vector256<int> index, Vector256<uint> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_mask_i32gather_epi64 (__m256i src, __int64 const* base_addr, __m128i vindex, __m256i mask, const int scale)
/// </summary>
public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector128<int> index, Vector256<long> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_mask_i32gather_epi64 (__m256i src, __int64 const* base_addr, __m128i vindex, __m256i mask, const int scale)
/// </summary>
public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector128<int> index, Vector256<ulong> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256 _mm256_mask_i32gather_ps (__m256 src, float const* base_addr, __m256i vindex, __m256 mask, const int scale)
/// </summary>
public static unsafe Vector256<float> GatherMaskVector256(Vector256<float> source, float* baseAddress, Vector256<int> index, Vector256<float> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256d _mm256_mask_i32gather_pd (__m256d src, double const* base_addr, __m128i vindex, __m256d mask, const int scale)
/// </summary>
public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector128<int> index, Vector256<double> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm256_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m256i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector256<long> index, Vector128<int> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128i _mm256_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m256i vindex, __m128i mask, const int scale)
/// </summary>
public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector256<long> index, Vector128<uint> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_mask_i64gather_epi64 (__m256i src, __int64 const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// </summary>
public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector256<long> index, Vector256<long> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256i _mm256_mask_i64gather_epi64 (__m256i src, __int64 const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// </summary>
public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector256<long> index, Vector256<ulong> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m128 _mm256_mask_i64gather_ps (__m128 src, float const* base_addr, __m256i vindex, __m128 mask, const int scale)
/// </summary>
public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector256<long> index, Vector128<float> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector128(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector128(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector128(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector128(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector128(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector128(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector128(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector128(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>
/// __m256d _mm256_mask_i64gather_pd (__m256d src, double const* base_addr, __m256i vindex, __m256d mask, const int scale)
/// </summary>
public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector256<long> index, Vector256<double> mask, byte scale)
{
- switch (scale)
+ return scale switch
{
- case 1:
- return GatherMaskVector256(source, baseAddress, index, mask, 1);
- case 2:
- return GatherMaskVector256(source, baseAddress, index, mask, 2);
- case 4:
- return GatherMaskVector256(source, baseAddress, index, mask, 4);
- case 8:
- return GatherMaskVector256(source, baseAddress, index, mask, 8);
- default:
- throw new ArgumentOutOfRangeException(nameof(scale));
- }
+ 1 => GatherMaskVector256(source, baseAddress, index, mask, 1),
+ 2 => GatherMaskVector256(source, baseAddress, index, mask, 2),
+ 4 => GatherMaskVector256(source, baseAddress, index, mask, 4),
+ 8 => GatherMaskVector256(source, baseAddress, index, mask, 8),
+ _ => throw new ArgumentOutOfRangeException(nameof(scale)),
+ };
}
/// <summary>