You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pa...@apache.org on 2026/06/17 12:19:25 UTC
(lucenenet) branch master updated: Fix debug asserts and docs for VIntUtils, #1279 (#1360)
This is an automated email from the ASF dual-hosted git repository.
paulirwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
The following commit(s) were added to refs/heads/master by this push:
new 0a16c76e6 Fix debug asserts and docs for VIntUtils, #1279 (#1360)
0a16c76e6 is described below
commit 0a16c76e6b596afe726fa5f0d6e250f3fdbe72f5
Author: Paul Irwin <pa...@gmail.com>
AuthorDate: Wed Jun 17 06:19:20 2026 -0600
Fix debug asserts and docs for VIntUtils, #1279 (#1360)
---
src/Lucene.Net/Support/VIntUtils.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Lucene.Net/Support/VIntUtils.cs b/src/Lucene.Net/Support/VIntUtils.cs
index b0c17a460..b678dfef8 100644
--- a/src/Lucene.Net/Support/VIntUtils.cs
+++ b/src/Lucene.Net/Support/VIntUtils.cs
@@ -43,8 +43,8 @@ internal static class VIntUtils
/// <summary>
/// Tries to read a 32-bit VInt from the given <paramref name="source"/>.
- /// <paramref name="source"/> must be at least <see cref="MaxVInt32Length"/> bytes
- /// in length to avoid possible out-of-range exceptions.
+ /// <paramref name="source"/> must be at least 1 byte in length, and be well-formed if multibyte,
+ /// to avoid possible out-of-range exceptions.
/// </summary>
/// <param name="source">The source bytes to read from.</param>
/// <param name="value">The decoded value (undefined if the method returns <c>false</c>).</param>
@@ -55,7 +55,7 @@ internal static class VIntUtils
/// extra high bits set.</returns>
public static bool TryReadVInt32(ReadOnlySpan<byte> source, out int value, out int count)
{
- Debug.Assert(source.Length >= MaxVInt32Length);
+ Debug.Assert(source.Length >= 1);
byte b = source[0];
if (b <= sbyte.MaxValue) // LUCENENET: Optimized equivalent of "if ((sbyte)b >= 0)"
{
@@ -98,8 +98,8 @@ public static bool TryReadVInt32(ReadOnlySpan<byte> source, out int value, out i
/// <summary>
/// Tries to read a 64-bit VInt from the given <paramref name="source"/>.
- /// <paramref name="source"/> must be at least <see cref="MaxVInt64Length"/> bytes
- /// in length to avoid possible out-of-range exceptions.
+ /// <paramref name="source"/> must be at least 1 byte in length, and be well-formed if multibyte,
+ /// to avoid possible out-of-range exceptions.
/// </summary>
/// <param name="source">The source bytes to read from.</param>
/// <param name="value">The decoded value (undefined if the method returns <c>false</c>).</param>
@@ -109,7 +109,7 @@ public static bool TryReadVInt32(ReadOnlySpan<byte> source, out int value, out i
/// the continuation bit set (which would indicate a negative value, disallowed).</returns>
public static bool TryReadVInt64(ReadOnlySpan<byte> source, out long value, out int count)
{
- Debug.Assert(source.Length >= MaxVInt64Length);
+ Debug.Assert(source.Length >= 1);
byte b = source[0];
if (b <= sbyte.MaxValue)
{