public void RunLclVarScenario_UnsafeRead()
        {
            var data   = Unsafe.ReadUnaligned <UInt64>(ref Unsafe.As <UInt64, byte>(ref _data));
            var result = Bmi1.ExtractLowestSetBit(data);

            ValidateResult(data, result);
        }
        public void RunStructLclFldScenario()
        {
            var test   = TestStruct.Create();
            var result = Bmi1.ExtractLowestSetBit(test._fld);

            ValidateResult(test._fld, result);
        }
        public void RunClassLclFldScenario()
        {
            var test   = new ScalarUnaryOpTest__ExtractLowestSetBitUInt64();
            var result = Bmi1.ExtractLowestSetBit(test._fld);

            ValidateResult(test._fld, result);
        }
Esempio n. 4
0
        public void RunClassFldScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));

            var result = Bmi1.ExtractLowestSetBit(_fld);

            ValidateResult(_fld, result);
        }
        public void RunClsVarScenario()
        {
            var result = Bmi1.ExtractLowestSetBit(
                _clsVar
                );

            ValidateResult(_clsVar, result);
        }
Esempio n. 6
0
        public void RunBasicScenario_UnsafeRead()
        {
            var result = Bmi1.ExtractLowestSetBit(
                Unsafe.ReadUnaligned <UInt32>(ref Unsafe.As <UInt32, byte>(ref _data))
                );

            ValidateResult(_data, result);
        }
Esempio n. 7
0
 public static int ExtractLowestSetBit(int n)
 {
     if (Bmi1.IsSupported)
     {
         return((int)Bmi1.ExtractLowestSetBit((uint)n));
     }
     return(n & -n);
 }
Esempio n. 8
0
        public void RunStructLclFldScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));

            var test   = TestStruct.Create();
            var result = Bmi1.ExtractLowestSetBit(test._fld);

            ValidateResult(test._fld, result);
        }
Esempio n. 9
0
        public void RunClassLclFldScenario()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));

            var test   = new ScalarUnaryOpTest__ExtractLowestSetBitUInt32();
            var result = Bmi1.ExtractLowestSetBit(test._fld);

            ValidateResult(test._fld, result);
        }
Esempio n. 10
0
        public void RunLclVarScenario_UnsafeRead()
        {
            TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));

            var data   = Unsafe.ReadUnaligned <UInt32>(ref Unsafe.As <UInt32, byte>(ref _data));
            var result = Bmi1.ExtractLowestSetBit(data);

            ValidateResult(data, result);
        }
Esempio n. 11
0
        public static uint ExtractLowestSetBit(int n)
        {
#if NETCOREAPP3_0_OR_GREATER
            if (Bmi1.IsSupported)
            {
                return(Bmi1.ExtractLowestSetBit((uint)n));
            }
#endif
            return((uint)(n & -n));
        }
        public override ulong Run(CancellationToken cancellationToken)
        {
            if (!Bmi1.IsSupported)
            {
                return(0uL);
            }

            var iterations = 0uL;
            var elsb       = randomInt;

            while (!cancellationToken.IsCancellationRequested)
            {
                for (var i = 0; i < LENGTH; i++)
                {
                    elsb = Bmi1.ExtractLowestSetBit(elsb);
                }

                iterations++;
            }

            return(iterations + elsb - elsb);
        }
Esempio n. 13
0
            public void RunStructFldScenario(ScalarUnaryOpTest__ExtractLowestSetBitUInt64 testClass)
            {
                var result = Bmi1.ExtractLowestSetBit(_fld);

                testClass.ValidateResult(_fld, result);
            }
Esempio n. 14
0
        public void RunClassFldScenario()
        {
            var result = Bmi1.ExtractLowestSetBit(_fld);

            ValidateResult(_fld, result);
        }