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

Function encode_fixed_size_binary

arrow-row/src/fixed.rs:326–348  ·  view source on GitHub ↗
(
    data: &mut [u8],
    offsets: &mut [usize],
    array: &FixedSizeBinaryArray,
    opts: SortOptions,
)

Source from the content-addressed store, hash-verified

324}
325
326pub fn encode_fixed_size_binary(
327 data: &mut [u8],
328 offsets: &mut [usize],
329 array: &FixedSizeBinaryArray,
330 opts: SortOptions,
331) {
332 let len = array.value_length() as usize;
333 for (offset, maybe_val) in offsets.iter_mut().skip(1).zip(array.iter()) {
334 let end_offset = *offset + len + 1;
335 if let Some(val) = maybe_val {
336 let to_write = &mut data[*offset..end_offset];
337 to_write[0] = 1;
338 to_write[1..].copy_from_slice(&val[..len]);
339 if opts.descending {
340 // Flip bits to reverse order
341 to_write[1..1 + len].iter_mut().for_each(|v| *v = !*v)
342 }
343 } else {
344 data[*offset] = null_sentinel(opts);
345 }
346 *offset = end_offset;
347 }
348}
349
350/// Splits `len` bytes from `src`
351#[inline]

Callers

nothing calls this directly

Calls 5

null_sentinelFunction · 0.85
zipMethod · 0.80
value_lengthMethod · 0.45
skipMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected