Vector128<uint> vecNarrow = Sse2.PackUnsignedSaturate(vecWide, vecWide).AsUInt32();
Unsafe.WriteUnaligned<uint>(ref outputBuffer, Sse2.ConvertToUInt32(vecNarrow));
}
+ else if (AdvSimd.IsSupported)
+ {
+ // Narrows a vector of words [ w0 w1 w2 w3 ] to a vector of bytes
+ // [ b0 b1 b2 b3 * * * * ], then writes 4 bytes (32 bits) to the destination.
+
+ Vector128<short> vecWide = Vector128.CreateScalarUnsafe(value).AsInt16();
+ Vector64<byte> lower = AdvSimd.ExtractNarrowingSaturateUnsignedLower(vecWide);
+ Unsafe.WriteUnaligned<uint>(ref outputBuffer, lower.AsUInt32().ToScalar());
+ }
+
else
{
if (BitConverter.IsLittleEndian)
public static Vector64<uint> CreateScalar(uint value) => throw new PlatformNotSupportedException();
public static Vector64<byte> AsByte<T>(this Vector64<T> vector) where T : struct => throw new PlatformNotSupportedException();
public static Vector64<uint> AsUInt32<T>(this Vector64<T> vector) where T : struct => throw new PlatformNotSupportedException();
+ public static Vector64<T> GetLower<T>(this Vector128<T> vector) where T : struct => throw new PlatformNotSupportedException();
+ public static Vector64<ulong> AsUInt64<T>(this Vector64<T> vector) where T : struct => throw new PlatformNotSupportedException();
}
internal readonly struct Vector64<T>
where T : struct
public static Vector128<short> Create(short value) => throw new PlatformNotSupportedException();
public static Vector128<ulong> Create(ulong value) => throw new PlatformNotSupportedException();
public static Vector128<ushort> Create(ushort value) => throw new PlatformNotSupportedException();
+ public static Vector128<byte> Create(byte value) => throw new PlatformNotSupportedException();
+ public static Vector128<uint> Create(uint value) => throw new PlatformNotSupportedException();
public static Vector128<ulong> CreateScalarUnsafe(ulong value) => throw new PlatformNotSupportedException();
public static Vector128<byte> AsByte<T>(this Vector128<T> vector) where T : struct => throw new PlatformNotSupportedException();
public static Vector128<short> AsInt16<T>(this Vector128<T> vector) where T : struct => throw new PlatformNotSupportedException();