You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2019/09/22 21:48:30 UTC
[lucenenet] 02/02: Lucene.Net.Util.OpenBitSet: Added comments to
indicate these changes differ from Lucene (closes #154)
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit f630a542f9abc5b0eb9b22f3737faf8285617a59
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Mon Sep 23 03:30:31 2019 +0700
Lucene.Net.Util.OpenBitSet: Added comments to indicate these changes differ from Lucene (closes #154)
---
src/Lucene.Net.Tests/Util/TestOpenBitSet.cs | 2 +-
src/Lucene.Net/Util/OpenBitSet.cs | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/Lucene.Net.Tests/Util/TestOpenBitSet.cs b/src/Lucene.Net.Tests/Util/TestOpenBitSet.cs
index dc873c3..abfc039 100644
--- a/src/Lucene.Net.Tests/Util/TestOpenBitSet.cs
+++ b/src/Lucene.Net.Tests/Util/TestOpenBitSet.cs
@@ -515,7 +515,7 @@ namespace Lucene.Net.Util
Assert.IsTrue(bits.FastGet(bit - 1));
}
- [Test]
+ [Test, LuceneNetSpecific] // https://github.com/apache/lucenenet/pull/154
public virtual void TestXorWithDifferentCapacity()
{
OpenBitSet smaller = new OpenBitSet(2);
diff --git a/src/Lucene.Net/Util/OpenBitSet.cs b/src/Lucene.Net/Util/OpenBitSet.cs
index 092d800..8bf7253 100644
--- a/src/Lucene.Net/Util/OpenBitSet.cs
+++ b/src/Lucene.Net/Util/OpenBitSet.cs
@@ -932,6 +932,11 @@ namespace Lucene.Net.Util
public virtual void Union(OpenBitSet other)
{
int newLen = Math.Max(m_wlen, other.m_wlen);
+ // LUCENENET specific: Since EnsureCapacityWords
+ // sets m_wlen, we need to save the value here to ensure the
+ // tail of the array is copied. Also removed the double-set
+ // after Array.Copy.
+ // https://github.com/apache/lucenenet/pull/154
int oldLen = m_wlen;
EnsureCapacityWords(newLen);
Debug.Assert((numBits = Math.Max(other.numBits, numBits)) >= 0);
@@ -967,6 +972,11 @@ namespace Lucene.Net.Util
public virtual void Xor(OpenBitSet other)
{
int newLen = Math.Max(m_wlen, other.m_wlen);
+ // LUCENENET specific: Since EnsureCapacityWords
+ // sets m_wlen, we need to save the value here to ensure the
+ // tail of the array is copied. Also removed the double-set
+ // after Array.Copy.
+ // https://github.com/apache/lucenenet/pull/154
int oldLen = m_wlen;
EnsureCapacityWords(newLen);
Debug.Assert((numBits = Math.Max(other.numBits, numBits)) >= 0);