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

Method with_bitset

arrow-buffer/src/buffer/mutable.rs:229–237  ·  view source on GitHub ↗

Set the bits in the range of `[0, end)` to 0 (if `val` is false), or 1 (if `val` is true). Also extend the length of this buffer to be `end`. This is useful when one wants to clear (or set) the bits and then manipulate the buffer directly (e.g., modifying the buffer by holding a mutable reference from `data_mut()`). # Panics Panics if `end` exceeds the buffer capacity.

(mut self, end: usize, val: bool)

Source from the content-addressed store, hash-verified

227 ///
228 /// Panics if `end` exceeds the buffer capacity.
229 pub fn with_bitset(mut self, end: usize, val: bool) -> Self {
230 assert!(end <= self.layout.size());
231 let v = if val { 255 } else { 0 };
232 unsafe {
233 std::ptr::write_bytes(self.data.as_ptr(), v, end);
234 self.len = end;
235 }
236 self
237 }
238
239 /// Ensure that `count` bytes from `start` contain zero bits
240 ///

Callers 8

create_bufferFunction · 0.80
bitwise_unary_op_helperFunction · 0.80
eq_scalar_innerFunction · 0.80
take_fixed_size_listFunction · 0.80
create_null_bufFunction · 0.80
write_array_dataFunction · 0.80

Calls 2

write_bytesFunction · 0.85
as_ptrMethod · 0.45

Tested by 1