Example #1
0
        internal static v128 SByteToLong(sbyte2 x)
        {
            if (Sse4_1.IsSse41Supported)
            {
                return(Sse4_1.cvtepi8_epi64(x));
            }
            else if (Sse2.IsSse2Supported)
            {
                v128 sign   = Sse2.cmpgt_epi8(default(v128), x);
                v128 shorts = Sse2.unpacklo_epi8(x, sign);

                sign = Sse2.unpacklo_epi8(sign, sign);
                v128 ints = Sse2.unpacklo_epi16(shorts, sign);

                sign = Sse2.unpacklo_epi16(sign, sign);
                return(Sse2.unpacklo_epi16(ints, sign));
            }
            else
            {
                throw new CPUFeatureCheckException();
            }
        }