Exemplo n.º 1
0
        internal static void BulkConvertNormalizedFloatToByteClampOverflows(ReadOnlySpan <float> source, Span <byte> dest)
        {
            DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!");

#if SUPPORTS_EXTENDED_INTRINSICS
            ExtendedIntrinsics.BulkConvertNormalizedFloatToByteClampOverflowsReduce(ref source, ref dest);
#else
            BasicIntrinsics256.BulkConvertNormalizedFloatToByteClampOverflowsReduce(ref source, ref dest);
#endif
            FallbackIntrinsics128.BulkConvertNormalizedFloatToByteClampOverflowsReduce(ref source, ref dest);

            // Deal with the remainder:
            if (source.Length > 0)
            {
                ConvertNormalizedFloatToByteRemainder(source, dest);
            }
        }
Exemplo n.º 2
0
        internal static void BulkConvertByteToNormalizedFloat(ReadOnlySpan <byte> source, Span <float> dest)
        {
            DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!");

#if NETCOREAPP2_1
            ExtendedIntrinsics.BulkConvertByteToNormalizedFloatReduce(ref source, ref dest);
#else
            BasicIntrinsics256.BulkConvertByteToNormalizedFloatReduce(ref source, ref dest);
#endif
            FallbackIntrinsics128.BulkConvertByteToNormalizedFloatReduce(ref source, ref dest);

            // Deal with the remainder:
            if (source.Length > 0)
            {
                ConverByteToNormalizedFloatRemainder(source, dest);
            }
        }
Exemplo n.º 3
0
        internal static void ByteToNormalizedFloat(ReadOnlySpan <byte> source, Span <float> dest)
        {
            DebugGuard.IsTrue(source.Length == dest.Length, nameof(source), "Input spans must be of same length!");

#if SUPPORTS_EXTENDED_INTRINSICS
            ExtendedIntrinsics.ByteToNormalizedFloatReduce(ref source, ref dest);
#else
            BasicIntrinsics256.ByteToNormalizedFloatReduce(ref source, ref dest);
#endif

            // Also deals with the remainder from previous conversions:
            FallbackIntrinsics128.ByteToNormalizedFloatReduce(ref source, ref dest);

            // Deal with the remainder:
            if (source.Length > 0)
            {
                ConvertByteToNormalizedFloatRemainder(source, dest);
            }
        }