Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Nov 21, 2024
1 parent a43fd67 commit 5adf93e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/Lucene.Net/Index/SortedSetDocValuesWriter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Lucene.Net.Diagnostics;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

namespace Lucene.Net.Index
Expand Down Expand Up @@ -201,9 +202,10 @@ private IEnumerable<BytesRef> GetValuesEnumerable(int valueCount, int[] sortedVa
}
}

[SuppressMessage("ReSharper", "AccessToStaticMemberViaDerivedType", Justification = "Matches Lucene")]
private IEnumerable<long?> GetOrdCountEnumerable(int maxDoc)
{
var iter = pendingCounts.GetIterator();
AppendingDeltaPackedInt64Buffer.Iterator iter = pendingCounts.GetIterator();

if (Debugging.AssertsEnabled) Debugging.Assert(pendingCounts.Count == maxDoc, "MaxDoc: {0}, pending.Count: {1}", maxDoc, pending.Count);

Expand All @@ -213,11 +215,12 @@ private IEnumerable<BytesRef> GetValuesEnumerable(int valueCount, int[] sortedVa
}
}

[SuppressMessage("ReSharper", "AccessToStaticMemberViaDerivedType", Justification = "Matches Lucene")]
private IEnumerable<long?> GetOrdsEnumerable(int[] ordMap, int maxCountPerDoc)
{
int currentUpTo = 0, currentLength = 0;
var iter = pending.GetIterator();
var counts = pendingCounts.GetIterator();
AppendingPackedInt64Buffer.Iterator iter = pending.GetIterator();
AppendingDeltaPackedInt64Buffer.Iterator counts = pendingCounts.GetIterator();
int[] cd = new int[maxCountPerDoc]; // LUCENENET specific - renamed from currentDoc to cd to prevent conflict

for (long ordUpto = 0; ordUpto < pending.Count; ++ordUpto)
Expand Down
5 changes: 3 additions & 2 deletions src/Lucene.Net/Support/CRC32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ namespace Lucene.Net.Support
{
internal class CRC32 : IChecksum
{
private static readonly uint[] crcTable = InitializeCRCTable();
private static readonly uint[] crcTable = LoadCRCTable();

private static uint[] InitializeCRCTable()
// LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006)
private static uint[] LoadCRCTable()
{
uint[] result = new uint[256];
for (uint n = 0; n < 256; n++)
Expand Down

0 comments on commit 5adf93e

Please sign in to comment.