From 33b4837411622e9650f42f42087a2bd395c1f5ab Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sun, 30 Apr 2023 21:58:38 +0200 Subject: [PATCH] BlockSizePow2BitShift added to PocBenchmarkBase for simpler reuse. --- Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs b/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs index e310976..689c121 100644 --- a/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs +++ b/Recyclable.Collections.Benchmarks/POC/PocBenchmarkBase.cs @@ -1,4 +1,5 @@ using BenchmarkDotNet.Attributes; +using System.Numerics; using System.Runtime.CompilerServices; namespace Recyclable.Collections.Benchmarks.POC @@ -30,6 +31,8 @@ namespace Recyclable.Collections.Benchmarks.POC _ => TestObjectCount / Divider > 0 ? checked((int)(TestObjectCount / Divider)) : checked((int)TestObjectCount) }; + public byte BlockSizePow2BitShift => checked((byte)(31 - BitOperations.LeadingZeroCount((uint)BlockSize))); + [MethodImpl(MethodImplOptions.NoInlining)] protected static void DoNothing(in T item) {