Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal static bool CompareTags(List<KeyValuePair<string, object?>>? sortedTags
}

int count = sortedTags.Count;
int size = count / (sizeof(long) * 8) + 1;
int size = count / (sizeof(ulong) * 8) + 1;
BitMapper bitMapper = new BitMapper(size <= 100 ? stackalloc ulong[size] : new ulong[size]);

if (tags2 is ICollection<KeyValuePair<string, object?>> tagsCol)
Expand Down Expand Up @@ -124,15 +124,15 @@ public BitMapper(Span<ulong> bitMap)
{
_bitMap = bitMap;
_bitMap.Clear();
_maxIndex = bitMap.Length * sizeof(long) * 8;
_maxIndex = bitMap.Length * sizeof(ulong) * 8;
}

public int MaxIndex => _maxIndex;

private static void GetIndexAndMask(int index, out int bitIndex, out ulong mask)
{
bitIndex = index >> 6;
int bit = index & (sizeof(long) * 8 - 1);
bitIndex = index >> 6; // divide by 64 == (sizeof(ulong) * 8) bits
int bit = index & (sizeof(ulong) * 8 - 1);
mask = 1UL << bit;
}

Expand Down