Dandandan commented on code in PR #8793:
URL: https://github.com/apache/arrow-rs/pull/8793#discussion_r2500945035
##########
arrow-buffer/src/buffer/ops.rs:
##########
@@ -102,26 +134,22 @@ pub fn bitwise_unary_op_helper<F>(
where
F: FnMut(u64) -> u64,
{
- // reserve capacity and set length so we can get a typed view of u64 chunks
- let mut result =
- MutableBuffer::new(ceil(len_in_bits, 8)).with_bitset(len_in_bits / 64
* 8, false);
-
- let left_chunks = left.bit_chunks(offset_in_bits, len_in_bits);
-
- let result_chunks = result.typed_data_mut::<u64>().iter_mut();
-
- result_chunks
- .zip(left_chunks.iter())
- .for_each(|(res, left)| {
- *res = op(left);
+ if len_in_bits == 0 {
+ return Buffer::default();
+ }
+ // already byte aligned, copy over directly
+ let len_in_bytes = ceil(len_in_bits, 8);
+ let mut result;
+ if offset_in_bits == 0 {
+ result = left.as_slice()[0..len_in_bytes].to_vec();
Review Comment:
This shouldn't be needed as well
--
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]