File tree Expand file tree Collapse file tree
encodings/fastlanes/src/delta/array Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,15 +18,14 @@ use vortex_error::VortexResult;
1818
1919use crate :: FL_CHUNK_SIZE ;
2020use crate :: bit_transpose:: transpose_validity;
21- use crate :: delta:: array:: unsigned_counterpart;
2221use crate :: fill_forward_nulls;
2322pub fn delta_compress (
2423 array : & PrimitiveArray ,
2524 ctx : & mut ExecutionCtx ,
2625) -> VortexResult < ( PrimitiveArray , PrimitiveArray ) > {
2726 let validity = array. validity ( ) ?;
2827 let original_ptype = array. ptype ( ) ;
29- let unsigned_ptype = unsigned_counterpart ( original_ptype) ;
28+ let unsigned_ptype = original_ptype. to_unsigned ( ) ;
3029 // Signed integers are processed through their unsigned counterpart: `wrapping_sub`
3130 // is bit-identical for signed and unsigned operands, so the encoded bytes are the
3231 // same regardless of how the buffer's elements are interpreted.
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ use vortex_error::VortexResult;
2020use crate :: DeltaArray ;
2121use crate :: bit_transpose:: untranspose_validity;
2222use crate :: delta:: array:: DeltaArrayExt ;
23- use crate :: delta:: array:: unsigned_counterpart;
2423
2524pub fn delta_decompress (
2625 array : & DeltaArray ,
@@ -36,7 +35,7 @@ pub fn delta_decompress(
3635 let validity = validity. slice ( start..end) ?;
3736
3837 let original_ptype = deltas. ptype ( ) ;
39- let unsigned_ptype = unsigned_counterpart ( original_ptype) ;
38+ let unsigned_ptype = original_ptype. to_unsigned ( ) ;
4039 // Signed inputs are processed through their unsigned counterpart; `wrapping_add` on the
4140 // raw bytes inverts the `wrapping_sub` done at compress time regardless of signedness.
4241 let ( bases, deltas) = if original_ptype == unsigned_ptype {
Original file line number Diff line number Diff line change @@ -116,22 +116,6 @@ impl DeltaData {
116116}
117117
118118pub ( crate ) fn lane_count ( ptype : PType ) -> usize {
119- match_each_unsigned_integer_ptype ! ( unsigned_counterpart ( ptype) , |T | { T :: LANES } )
119+ match_each_unsigned_integer_ptype ! ( ptype. to_unsigned ( ) , |T | { T :: LANES } )
120120}
121121
122- /// Map a signed integer [`PType`] to its same-width unsigned counterpart; other [`PType`]s
123- /// pass through unchanged.
124- ///
125- /// The FastLanes kernels (`Delta::delta`, `Transpose::transpose`, ...) are only implemented
126- /// for unsigned integer types. Signed inputs are processed by viewing the same bytes through
127- /// the unsigned counterpart; `wrapping_sub` / `wrapping_add` are bit-identical for signed and
128- /// unsigned operands under two's-complement, so the round-trip is exact.
129- pub ( crate ) fn unsigned_counterpart ( ptype : PType ) -> PType {
130- match ptype {
131- PType :: I8 => PType :: U8 ,
132- PType :: I16 => PType :: U16 ,
133- PType :: I32 => PType :: U32 ,
134- PType :: I64 => PType :: U64 ,
135- other => other,
136- }
137- }
You can’t perform that action at this time.
0 commit comments