Skip to content

Commit b6da380

Browse files
committed
Revert back to Span-based Arrays.Copy method
1 parent 58bc7a9 commit b6da380

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/Lucene.Net.Analysis.Common/Analysis/Util/StemmerUtil.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Lucene version compatibility level 4.8.1
22
using Lucene.Net.Diagnostics;
3+
using Lucene.Net.Support;
34
using System;
45

56
namespace Lucene.Net.Analysis.Util
@@ -182,8 +183,7 @@ public static int Delete(Span<char> s, int pos)
182183
if (Debugging.AssertsEnabled) Debugging.Assert(pos < s.Length);
183184
if (pos < s.Length - 1) // don't arraycopy if asked to delete last character
184185
{
185-
// Arrays.Copy(s, pos + 1, s, pos, len - pos - 1);
186-
s.Slice(pos + 1, s.Length - pos - 1).CopyTo(s.Slice(pos, s.Length - pos - 1));
186+
Arrays.Copy(s, pos + 1, s, pos, s.Length - pos - 1);
187187
}
188188
return s.Length - 1;
189189
}
@@ -220,8 +220,7 @@ public static int DeleteN(Span<char> s, int pos, int nChars)
220220
if (Debugging.AssertsEnabled) Debugging.Assert(pos + nChars <= s.Length);
221221
if (pos + nChars < s.Length) // don't arraycopy if asked to delete the last characters
222222
{
223-
// Arrays.Copy(s, pos + nChars, s, pos, len - pos - nChars);
224-
s.Slice(pos + nChars, s.Length - pos - nChars).CopyTo(s.Slice(pos, s.Length - pos - nChars));
223+
Arrays.Copy(s, pos + nChars, s, pos, s.Length - pos - nChars);
225224
}
226225
return s.Length - nChars;
227226
}

0 commit comments

Comments
 (0)