Пример #1
0
 public static sbyte16 subadd(sbyte16 a, sbyte16 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new v128(255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1)));
     }
     else
     {
         return(a - select(b, -b, new bool16(false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true)));
     }
 }
Пример #2
0
 public static sbyte2 subadd(sbyte2 a, sbyte2 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte2(255, 1)));
     }
     else
     {
         return(a - select(b, -b, new bool2(false, true)));
     }
 }
Пример #3
0
 public static sbyte4 subadd(sbyte4 a, sbyte4 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte4(255, 1, 255, 1)));
     }
     else
     {
         return(a - select(b, -b, new bool4(false, true, false, true)));
     }
 }
Пример #4
0
 public static byte3 subadd(byte3 a, byte3 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte4(255, 1, 255, 1)));
     }
     else
     {
         return(a - select(b, (byte3)(-(sbyte3)b), new bool3(false, true, false)));
     }
 }
Пример #5
0
 public static byte8 subadd(byte8 a, byte8 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte8(255, 1, 255, 1, 255, 1, 255, 1)));
     }
     else
     {
         return(a - select(b, (byte8)(-(sbyte8)b), new bool8(false, true, false, true, false, true, false, true)));
     }
 }
Пример #6
0
 public static sbyte8 addsub(sbyte8 a, sbyte8 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte8(1, 255, 1, 255, 1, 255, 1, 255)));
     }
     else
     {
         return(a + select(b, -b, new bool8(false, true, false, true, false, true, false, true)));
     }
 }
Пример #7
0
 public static byte16 addsub(byte16 a, byte16 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new v128(1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255)));
     }
     else
     {
         return(a + select(b, (byte16)(-(sbyte16)b), new bool16(false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true)));
     }
 }
Пример #8
0
 public static byte4 addsub(byte4 a, byte4 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte4(1, 255, 1, 255)));
     }
     else
     {
         return(a + select(b, (byte4)(-(sbyte4)b), new bool4(false, true, false, true)));
     }
 }
Пример #9
0
 public static byte2 addsub(byte2 a, byte2 b)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(a + Ssse3.sign_epi8(b, new byte2(1, 255)));
     }
     else
     {
         return(a + select(b, (byte2)(-(sbyte2)b), new bool2(false, true)));
     }
 }
Пример #10
0
 public static sbyte8 sign(sbyte8 x)
 {
     if (Ssse3.IsSsse3Supported)
     {
         return(Ssse3.sign_epi8(new sbyte8(1), x));
     }
     else if (Sse2.IsSse2Supported)
     {
         return(((sbyte8)Sse2.cmpgt_epi8(x, default(v128)) & 1) + Sse2.cmpgt_epi8(default(v128), x));
     }
     else
     {
         return((x >> 7) | (sbyte8)((byte8)(-x) >> 7));
     }
 }