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); }
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); }
public void RunBasicScenario_UnsafeRead() { var result = Bmi1.ExtractLowestSetBit( Unsafe.ReadUnaligned <UInt32>(ref Unsafe.As <UInt32, byte>(ref _data)) ); ValidateResult(_data, result); }
public static int ExtractLowestSetBit(int n) { if (Bmi1.IsSupported) { return((int)Bmi1.ExtractLowestSetBit((uint)n)); } return(n & -n); }
public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Bmi1.ExtractLowestSetBit(test._fld); ValidateResult(test._fld, result); }
public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ScalarUnaryOpTest__ExtractLowestSetBitUInt32(); var result = Bmi1.ExtractLowestSetBit(test._fld); ValidateResult(test._fld, result); }
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); }
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); }
public void RunStructFldScenario(ScalarUnaryOpTest__ExtractLowestSetBitUInt64 testClass) { var result = Bmi1.ExtractLowestSetBit(_fld); testClass.ValidateResult(_fld, result); }
public void RunClassFldScenario() { var result = Bmi1.ExtractLowestSetBit(_fld); ValidateResult(_fld, result); }