Exemplo n.º 1
0
 internal static v128 BlendV(v128 a, v128 b, v128 mask, bool integer = true)
 {
     if (Sse4_1.IsSse41Supported)
     {
         if (integer)
         {
             return(Sse4_1.blendv_epi8(a, b, mask));
         }
         else
         {
             return(Sse4_1.blendv_ps(a, b, mask));
         }
     }
     else if (Sse2.IsSse2Supported)
     {
         // UNSAFE - performs bit-by-bit blend and not byte-by-byte
         if (integer)
         {
             return(Sse2.or_si128(Sse2.and_si128(mask, b),
                                  Sse2.andnot_si128(mask, a)));
         }
         else
         {
             return(Sse.or_ps(Sse.and_ps(mask, b),
                              Sse.andnot_ps(mask, a)));
         }
     }
     else
     {
         throw new CPUFeatureCheckException();
     }
 }