예제 #1
0
 private static void Add(Span <float> src, Span <float> dst)
 {
     if (Avx.IsSupported)
     {
         AvxIntrinsics.AddU(src, dst);
     }
     else if (Sse.IsSupported)
     {
         SseIntrinsics.AddU(src, dst);
     }
     else
     {
         for (int i = 0; i < dst.Length; i++)
         {
             dst[i] += src[i];
         }
     }
 }
예제 #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];
                }
            }
        }
예제 #4
0
 public void AddU()
 => AvxIntrinsics.AddU(src, dst, Length);
예제 #5
0
 public void ManagedAddUPerf()
 {
     AvxIntrinsics.AddU(new Span <float>(src, 0, LEN), new Span <float>(dst, 0, LEN));
 }
 public void AddU()
 => AvxIntrinsics.AddU(new Span <float>(src, 0, LEN), new Span <float>(dst, 0, LEN));