Example #1
0
        public static Span128 <ulong> add(ReadOnlySpan128 <ulong> lhs, ReadOnlySpan128 <ulong> rhs, Span128 <ulong> dst)
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                vstore(dinx.add(lhs.LoadVec128(block), rhs.LoadVec128(block)), ref dst.Block(block));
            }
            return(dst);
        }
Example #2
0
        public static Span128 <float> fmul(ReadOnlySpan128 <float> lhs, ReadOnlySpan128 <float> rhs, Span128 <float> dst)
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                vstore(dfp.fmul(lhs.LoadVec128(block), rhs.LoadVec128(block)), ref dst.Block(block));
            }
            return(dst);
        }
Example #3
0
        public static Span128 <double> div(ReadOnlySpan128 <double> lhs, ReadOnlySpan128 <double> rhs, Span128 <double> dst)
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                vstore(dfp.div(lhs.LoadVec128(block), rhs.LoadVec128(block)), ref dst[block]);
            }
            return(dst);
        }
Example #4
0
File: sub.g.cs Project: 0xCM/arrows
        public static Span128 <T> sub <T>(ReadOnlySpan128 <T> lhs, ReadOnlySpan128 <T> rhs, Span128 <T> dst)
            where T : struct
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                store(ginx.sub(ginx.lddqu128(in lhs.Block(block)), ginx.lddqu128(in rhs.Block(block))), ref dst.Block(block));
            }
            return(dst);
        }
Example #5
0
 /// <summary>
 /// Asserts content equality for two blocked spans of primal type
 /// </summary>
 /// <param name="lhs">The left span</param>
 /// <param name="rhs">The right span</param>
 /// <param name="caller">The invoking function</param>
 /// <param name="file">The file in which the invoking function is defined </param>
 /// <param name="line">The file line number of invocation</param>
 /// <typeparam name="T">The element type</typeparam>
 public static void ClaimEqual <T>(this ReadOnlySpan128 <T> lhs, ReadOnlySpan128 <T> rhs, [Member] string caller = null, [File] string file = null, [Line] int?line = null)
     where T : struct
 {
     for (var i = 0; i < Span128.Length(lhs, rhs); i++)
     {
         if (!gmath.eq(lhs[i], rhs[i]))
         {
             throw Errors.ItemsNotEqual(i, lhs[i], rhs[i], caller, file, line);
         }
     }
 }
Example #6
0
 public static bool Identical <T>(this ReadOnlySpan128 <T> lhs, ReadOnlySpan128 <T> rhs)
     where T : struct
 {
     for (var i = 0; i < Span128.Length(lhs, rhs); i++)
     {
         if (gmath.neq(lhs[i], rhs[i]))
         {
             return(false);
         }
     }
     return(true);
 }
Example #7
0
 public static Span128 <T> add <T>(ReadOnlySpan128 <T> lhs, ReadOnlySpan128 <T> rhs, Span128 <T> dst)
     where T : struct
 {
     if (typeof(T) == typeof(sbyte))
     {
         dinx.add(int8(lhs), int8(rhs), int8(dst));
     }
     else if (typeof(T) == typeof(byte))
     {
         dinx.add(uint8(lhs), uint8(rhs), uint8(dst));
     }
     else if (typeof(T) == typeof(short))
     {
         dinx.add(int16(lhs), int16(rhs), int16(dst));
     }
     else if (typeof(T) == typeof(ushort))
     {
         dinx.add(uint16(lhs), uint16(rhs), uint16(dst));
     }
     else if (typeof(T) == typeof(int))
     {
         dinx.add(int32(lhs), int32(rhs), int32(dst));
     }
     else if (typeof(T) == typeof(uint))
     {
         dinx.add(uint32(lhs), uint32(rhs), uint32(dst));
     }
     else if (typeof(T) == typeof(long))
     {
         dinx.add(int64(lhs), int64(rhs), int64(dst));
     }
     else if (typeof(T) == typeof(ulong))
     {
         dinx.add(uint64(lhs), uint64(rhs), uint64(dst));
     }
     else if (typeof(T) == typeof(float))
     {
         dfp.add(float32(lhs), float32(rhs), float32(dst));
     }
     else if (typeof(T) == typeof(double))
     {
         dfp.add(float64(lhs), float64(rhs), float64(dst));
     }
     else
     {
         throw unsupported <T>();
     }
     return(dst);
 }
Example #8
0
 public static Vec128 <T> LoadVec128 <T>(this ReadOnlySpan128 <T> src, int block = 0)
     where T : unmanaged
 => Vec128.Load(src, block);
Example #9
0
File: num.x.cs Project: 0xCM/arrows
 public static Scalar128 <T> ToScalar128 <T>(this ReadOnlySpan128 <T> src, int block = 0)
     where T : struct
 => Num128.load(src, block);
Example #10
0
 public static string FormatList <T>(this ReadOnlySpan128 <T> src, char delimiter = ',', int offset = 0)
     where T : struct
 => src.Unblocked.FormatList(delimiter, offset);