Esempio n. 1
0
        static Vec256 <T> ClearAlternating()
        {
            var mask = Span256.Alloc <T>(1);
            var chop = PrimalInfo.Get <T>().MaxVal;

            //For the first 128-bit lane
            var half = mask.Length / 2;

            for (byte i = 0; i < half; i++)
            {
                if (i % 2 != 0)
                {
                    mask[i] = chop;
                }
                else
                {
                    mask[i] = convert <byte, T>(i);
                }
            }

            //For the second 128-bit lane
            for (byte i = 0; i < half; i++)
            {
                if (i % 2 != 0)
                {
                    mask[i + half] = chop;
                }
                else
                {
                    mask[i + half] = convert <byte, T>(i);
                }
            }

            return(Vec256.Load(mask));
        }
Esempio n. 2
0
        protected virtual Interval <byte> ShiftRange <K>()
            where K : unmanaged
        {
            var offsetMin = (byte)1;
            var offsetMax = (byte)(PrimalInfo.Get <K>().BitSize - 2);

            return(closed(offsetMin, offsetMax));
        }