public static int4 subadd(int4 a, int4 b) { if (Ssse3.IsSsse3Supported) { v128 temp = Ssse3.sign_epi32(*(v128 *)&b, new v128(uint.MaxValue, 1, uint.MaxValue, 1)); return(a + *(int4 *)&temp); } else { return(a - math.select(b, -b, new bool4(false, true, false, true))); } }
public static uint3 subadd(uint3 a, uint3 b) { if (Ssse3.IsSsse3Supported) { v128 temp = Ssse3.sign_epi32(*(v128 *)&b, new v128(uint.MaxValue, 1, uint.MaxValue, 1)); return(a + *(uint3 *)&temp); } else { return(a - math.select(b, (uint3)(-(int3)b), new bool3(false, true, false))); } }
public static uint2 subadd(uint2 a, uint2 b) { if (Ssse3.IsSsse3Supported) { v128 temp = Ssse3.sign_epi32(*(v128 *)&b, new v128(uint.MaxValue, 1, 0, 0)); return(a + *(uint2 *)&temp); } else { return(a - math.select(b, (uint2)(-(int2)b), new bool2(false, true))); } }
public static int3 addsub(int3 a, int3 b) { if (Ssse3.IsSsse3Supported) { v128 temp = Ssse3.sign_epi32(*(v128 *)&b, new v128(1, uint.MaxValue, 1, uint.MaxValue)); return(a + *(int3 *)&temp); } else { return(a + math.select(b, -b, new bool3(false, true, false))); } }
public static uint4 addsub(uint4 a, uint4 b) { if (Ssse3.IsSsse3Supported) { v128 temp = Ssse3.sign_epi32(*(v128 *)&b, new v128(1, uint.MaxValue, 1, uint.MaxValue)); return(a + *(uint4 *)&temp); } else { return(a + math.select(b, (uint4)(-(int4)b), new bool4(false, true, false, true))); } }
public static int4 sign(int4 x) { if (Ssse3.IsSsse3Supported) { v128 temp = Ssse3.sign_epi32(new v128(1), *(v128 *)&x); return(*(int4 *)&temp); } else { return((x >> 31) | (int4)((uint4)(-x) >> 31)); } }