Exemplo n.º 1
0
 private static void Add(Span <float> src, Span <float> dst)
 {
     if (Sse.IsSupported)
     {
         SseIntrinsics.AddU(src, dst);
     }
     else
     {
         for (int i = 0; i < dst.Length; i++)
         {
             dst[i] += src[i];
         }
     }
 }
Exemplo n.º 2
0
        public static void Add(ReadOnlySpan <float> source, Span <float> destination, int count)
        {
            Contracts.AssertNonEmpty(source);
            Contracts.AssertNonEmpty(destination);
            Contracts.Assert(count > 0);
            Contracts.Assert(count <= source.Length);
            Contracts.Assert(count <= destination.Length);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.AddU(source, destination, count);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.AddU(source, destination, count);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    destination[i] += source[i];
                }
            }
        }
        public static void Add(ReadOnlySpan <float> src, Span <float> dst, int count)
        {
            Contracts.AssertNonEmpty(src);
            Contracts.AssertNonEmpty(dst);
            Contracts.Assert(count > 0);
            Contracts.Assert(count <= src.Length);
            Contracts.Assert(count <= dst.Length);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.AddU(src, dst, count);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.AddU(src, dst, count);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    dst[i] += src[i];
                }
            }
        }