eerhardt commented on code in PR #35342:
URL: https://github.com/apache/arrow/pull/35342#discussion_r1190285881


##########
csharp/src/Apache.Arrow/BitUtility.cs:
##########
@@ -62,73 +62,146 @@ public static void SetBit(Span<byte> data, int index, bool 
value)
                 : (byte)(data[idx] & ~BitMask[mod]);
         }
 
+        /// <summary>
+        /// Set the number of bits in a span of bytes starting
+        /// at a specific index, and limiting to length.
+        /// </summary>
+        /// <param name="data">Span to set bits value.</param>
+        /// <param name="index">Bit index to start counting from.</param>
+        /// <param name="length">Maximum of bits in the span to 
consider.</param>
+        internal static void SetBits(Span<byte> data, int index, int length, 
bool value)
+        {
+            if (length == 0)
+                return;
+
+            long spanLengthInBits = (long)data.Length * 8;
+
+            if (index < 0 || index >= spanLengthInBits)
+                throw new ArgumentOutOfRangeException(nameof(index));
+
+            int endBitIndex = checked(index + length - 1);
+
+            if (length < 0 || endBitIndex >= spanLengthInBits)
+                throw new ArgumentOutOfRangeException(nameof(length));

Review Comment:
   Do we still need this argument checking now that the method is `internal`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to