Example #1
0
        public static ulong bits_extractparallel(ulong x, ulong mask)
        {
            if (Bmi2.IsBmi2Supported)
            {
                return(Bmi2.pext_u64(x, mask));
            }
            else
            {
                ulong result = 0;

                for (ulong i = 1; mask != 0; i += i)
                {
                    if ((x & bits_extractlowest(mask)) != 0)
                    {
                        result |= i;
                    }
                    else
                    {
                    }

                    mask = bits_resetlowest(mask);
                }
                return(result);
            }
        }