Exemple #1
0
 private static void ScaleAdd(float a, float b, Span <float> dst)
 {
     if (Sse.IsSupported)
     {
         SseIntrinsics.ScaleAddU(a, b, dst);
     }
     else
     {
         for (int i = 0; i < dst.Length; i++)
         {
             dst[i] = a * (dst[i] + b);
         }
     }
 }
Exemple #2
0
        // destination[i] = scale * (destination[i] + addend)
        public static void ScaleAdd(float scale, float addend, Span <float> destination)
        {
            Contracts.AssertNonEmpty(destination);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.ScaleAddU(scale, addend, destination);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.ScaleAddU(scale, addend, destination);
            }
            else
            {
                for (int i = 0; i < destination.Length; i++)
                {
                    destination[i] = scale * (destination[i] + addend);
                }
            }
        }
        // dst[i] = a * (dst[i] + b)
        public static void ScaleAdd(float a, float b, Span <float> dst)
        {
            Contracts.AssertNonEmpty(dst);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.ScaleAddU(a, b, dst);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.ScaleAddU(a, b, dst);
            }
            else
            {
                for (int i = 0; i < dst.Length; i++)
                {
                    dst[i] = a * (dst[i] + b);
                }
            }
        }