Open
Description
Describe the enhancement requested
The C# implementation of the BitUtility helper class seems to allocate an array every time GetBit is called:
private static ReadOnlySpan<byte> BitMask => new byte[] {
1, 2, 4, 8, 16, 32, 64, 128
};
public static bool GetBit(ReadOnlySpan<byte> data, int index) =>
(data[index / 8] & BitMask[index % 8]) != 0;
using a static cached BitMask array or creating the bit mask using a shift operator should increase performance.
Component(s)
C#