Skip to content

Commit fc26692

Browse files
committed
Change `BooleanBuffer::append_packed_range to use bitwise_binary_op
1 parent 1fb4981 commit fc26692

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arrow-buffer/src/builder/boolean.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use crate::{BooleanBuffer, Buffer, MutableBuffer, bit_mask, bit_util};
18+
use crate::bit_util::bitwise_binary_op;
19+
use crate::{BooleanBuffer, Buffer, MutableBuffer, bit_util};
1920
use std::ops::Range;
2021

2122
/// Builder for [`BooleanBuffer`]
@@ -218,13 +219,16 @@ impl BooleanBufferBuilder {
218219
pub fn append_packed_range(&mut self, range: Range<usize>, to_set: &[u8]) {
219220
let offset_write = self.len;
220221
let len = range.end - range.start;
222+
// allocate new bits as 0
221223
self.advance(len);
222-
bit_mask::set_bits(
224+
// copy bits from to_set into self.buffer a word at a time
225+
bitwise_binary_op(
223226
self.buffer.as_slice_mut(),
224-
to_set,
225227
offset_write,
228+
to_set,
226229
range.start,
227230
len,
231+
|_a, b| b, // copy bits from to_set
228232
);
229233
}
230234

0 commit comments

Comments
 (0)