public static void Shuffle4Reduce( ref ReadOnlySpan <byte> source, ref Span <byte> dest, byte control) { if (Avx2.IsSupported || Ssse3.IsSupported) { int remainder = Avx2.IsSupported ? Numerics.ModuloP2(source.Length, Vector256 <byte> .Count) : Numerics.ModuloP2(source.Length, Vector128 <byte> .Count); int adjustedCount = source.Length - remainder; if (adjustedCount > 0) { Shuffle4( source.Slice(0, adjustedCount), dest.Slice(0, adjustedCount), control); source = source.Slice(adjustedCount); dest = dest.Slice(adjustedCount); } } }
internal static void ByteToNormalizedFloatReduce( ref ReadOnlySpan <byte> source, ref Span <float> dest) { DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!"); if (!IsAvailable) { return; } int remainder = Numerics.ModuloP2(source.Length, Vector <byte> .Count); int adjustedCount = source.Length - remainder; if (adjustedCount > 0) { ByteToNormalizedFloat(source.Slice(0, adjustedCount), dest.Slice(0, adjustedCount)); source = source.Slice(adjustedCount); dest = dest.Slice(adjustedCount); } }