Skip to content

Commit

Permalink
Try to inline WithCompute calls
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 committed Apr 9, 2024
1 parent 964d852 commit 0de3867
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fastlanez/src/bitpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mod test {
assert_eq!(output.len(), 1280);

input.iter().enumerate().for_each(|(i, v)| {
let decoded = <u32 as TryBitPack>::try_unpack_single(&output, 10, i).unwrap();
let decoded = u32::try_unpack_single(&output, 10, i).unwrap();
assert_eq!(decoded, *v);
});
}
Expand Down
1 change: 1 addition & 0 deletions vortex-array/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub trait WithArrayCompute {
}

impl WithArrayCompute for dyn Array + '_ {
#[inline]
fn with_compute<R, F: Fn(&dyn ArrayCompute) -> VortexResult<R>>(
&self,
f: F,
Expand Down
4 changes: 2 additions & 2 deletions vortex-fastlanes/src/bitpacking/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ pub fn unpack_primitive<T: NativePType + TryBitPack>(

pub(crate) fn unpack_single(array: &BitPackedArray, index: usize) -> VortexResult<Scalar> {
let bit_width = array.bit_width();
let encoded = flatten_primitive(cast(array.encoded(), U8.into())?.as_ref())?;
let encoded = flatten_primitive(&cast(array.encoded(), U8.into())?)?;
let ptype: PType = array.dtype().try_into()?;
let index_in_encoded = index + array.offset();

Expand Down Expand Up @@ -289,7 +289,7 @@ pub unsafe fn unpack_single_primitive<T: NativePType + TryBitPack>(
let chunk_bytes = &packed[chunk_index * bytes_per_chunk..][0..bytes_per_chunk];
let index_in_chunk = index_to_decode % 1024;

<T as TryBitPack>::try_unpack_single(chunk_bytes, bit_width, index_in_chunk)
T::try_unpack_single(chunk_bytes, bit_width, index_in_chunk)
.map_err(|_| vortex_err!("Unsupported bit width {}", bit_width))
}

Expand Down

0 comments on commit 0de3867

Please sign in to comment.