Skip to content

Commit 862b262

Browse files
committed
move BitPackingStrategy to a more sensible place
Signed-off-by: Connor Tsui <[email protected]>
1 parent 702b700 commit 862b262

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

encodings/fastlanes/src/bitpacking/array/bitpack_decompress.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,14 @@ use vortex_array::arrays::PrimitiveArray;
88
use vortex_array::builders::{ArrayBuilder, PrimitiveBuilder, UninitRange};
99
use vortex_array::patches::Patches;
1010
use vortex_dtype::{
11-
IntegerPType, NativePType, PhysicalPType, match_each_integer_ptype,
12-
match_each_unsigned_integer_ptype,
11+
IntegerPType, NativePType, match_each_integer_ptype, match_each_unsigned_integer_ptype,
1312
};
1413
use vortex_error::VortexExpect;
1514
use vortex_mask::Mask;
1615
use vortex_scalar::Scalar;
1716

1817
use crate::BitPackedArray;
19-
use crate::unpack_iter::{BitPacked, UnpackStrategy};
20-
21-
/// BitPacking strategy - uses plain bitpacking without reference value
22-
pub struct BitPackingStrategy;
23-
24-
impl<T: PhysicalPType<Physical: BitPacking>> UnpackStrategy<T> for BitPackingStrategy {
25-
#[inline(always)]
26-
unsafe fn unpack_chunk(
27-
&self,
28-
bit_width: usize,
29-
chunk: &[T::Physical],
30-
dst: &mut [T::Physical],
31-
) {
32-
// SAFETY: Caller must ensure [`BitPacking::unchecked_unpack`] safety requirements hold.
33-
unsafe {
34-
BitPacking::unchecked_unpack(bit_width, chunk, dst);
35-
}
36-
}
37-
}
18+
use crate::unpack_iter::BitPacked;
3819

3920
pub fn unpack(array: &BitPackedArray) -> PrimitiveArray {
4021
match_each_integer_ptype!(array.ptype(), |P| { unpack_primitive::<P>(array) })

encodings/fastlanes/src/bitpacking/array/unpack_iter.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use vortex_buffer::ByteBuffer;
1313
use vortex_dtype::PhysicalPType;
1414

1515
use crate::BitPackedArray;
16-
use crate::bitpacking::bitpack_decompress::BitPackingStrategy;
1716

1817
const CHUNK_SIZE: usize = 1024;
1918

@@ -27,6 +26,24 @@ pub trait UnpackStrategy<T: PhysicalPType> {
2726
unsafe fn unpack_chunk(&self, bit_width: usize, chunk: &[T::Physical], dst: &mut [T::Physical]);
2827
}
2928

29+
/// BitPacking strategy - uses plain bitpacking without reference value
30+
pub struct BitPackingStrategy;
31+
32+
impl<T: PhysicalPType<Physical: BitPacking>> UnpackStrategy<T> for BitPackingStrategy {
33+
#[inline(always)]
34+
unsafe fn unpack_chunk(
35+
&self,
36+
bit_width: usize,
37+
chunk: &[T::Physical],
38+
dst: &mut [T::Physical],
39+
) {
40+
// SAFETY: Caller must ensure [`BitPacking::unchecked_unpack`] safety requirements hold.
41+
unsafe {
42+
BitPacking::unchecked_unpack(bit_width, chunk, dst);
43+
}
44+
}
45+
}
46+
3047
/// Accessor to unpacked chunks of bitpacked arrays
3148
///
3249
/// The usual pattern of usage should follow

0 commit comments

Comments
 (0)