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


##########
csharp/src/Apache.Arrow/ArrowBuffer.BitmapBuilder.cs:
##########
@@ -138,6 +138,28 @@ public BitmapBuilder AppendRange(IEnumerable<bool> values)
                 return this;
             }
 
+
+            /// <summary>
+            /// Append multiple bits.
+            /// </summary>
+            /// <param name="value">Value of bits to append.</param>
+            /// <param name="length">Number of times the value should be 
added.</param>
+            /// <returns>Returns the builder (for fluent-style 
composition).</returns>
+            public BitmapBuilder AppendRange(bool value, int length)
+            {
+                EnsureAdditionalCapacity(length);
+
+                for (int i = 0; i < length; i++)
+                {
+                    BitUtility.SetBit(Span, Length, value);
+                    Length++;
+                }
+                                
+                SetBitCount += value ? length : 0;
+
+                return this;
+            }

Review Comment:
   Thanks for you suggestion. I like the idea! Similar approach is used in 
BitUtility.CountBits method, so I added a complementary implementation of 
SetBits method to BitUtility and used it in BitmapBuilder. I also changed 
CountBits to follow project official coding style.



-- 
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