MCPcopy Create free account
hub / github.com/apache/arrow-rs / bitwise_bin_op_assign

Method bitwise_bin_op_assign

arrow-buffer/src/buffer/boolean.rs:576–607  ·  view source on GitHub ↗

Apply a bitwise binary operation to `self`. If the underlying buffer is uniquely owned, reuses the allocation and updates the bytes in place. If the underlying buffer is shared, returns a newly allocated buffer. # API Notes If the buffer is reused, the result preserves the existing offset, which may be non-zero.

(&mut self, rhs: &BooleanBuffer, op: F)

Source from the content-addressed store, hash-verified

574 /// If the buffer is reused, the result preserves the existing offset, which
575 /// may be non-zero.
576 fn bitwise_bin_op_assign<F>(&mut self, rhs: &BooleanBuffer, op: F)
577 where
578 F: FnMut(u64, u64) -> u64,
579 {
580 assert_eq!(self.bit_len, rhs.bit_len);
581 // Try to mutate in place if the buffer is uniquely owned
582 let buffer = std::mem::take(&mut self.buffer);
583 match buffer.into_mutable() {
584 Ok(mut buf) => {
585 bit_util::apply_bitwise_binary_op(
586 &mut buf,
587 self.bit_offset,
588 &rhs.buffer,
589 rhs.bit_offset,
590 self.bit_len,
591 op,
592 );
593 self.buffer = buf.into();
594 }
595 Err(buf) => {
596 self.buffer = buf;
597 *self = BooleanBuffer::from_bitwise_binary_op(
598 self.values(),
599 self.bit_offset,
600 rhs.values(),
601 rhs.bit_offset,
602 self.bit_len,
603 op,
604 );
605 }
606 }
607 }
608
609 /// Returns an iterator over the bits in this [`BooleanBuffer`]
610 pub fn iter(&self) -> BitIterator<'_> {

Callers 3

bitand_assignMethod · 0.80
bitor_assignMethod · 0.80
bitxor_assignMethod · 0.80

Calls 4

takeFunction · 0.85
apply_bitwise_binary_opFunction · 0.85
into_mutableMethod · 0.80
valuesMethod · 0.45

Tested by

no test coverage detected