Skip to content

Commit c490bb9

Browse files
committed
u
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 48d5602 commit c490bb9

3 files changed

Lines changed: 3 additions & 21 deletions

File tree

encodings/fastlanes/src/delta/array/delta_compress.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ use vortex_error::VortexResult;
1818

1919
use crate::FL_CHUNK_SIZE;
2020
use crate::bit_transpose::transpose_validity;
21-
use crate::delta::array::unsigned_counterpart;
2221
use crate::fill_forward_nulls;
2322
pub 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.

encodings/fastlanes/src/delta/array/delta_decompress.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use vortex_error::VortexResult;
2020
use crate::DeltaArray;
2121
use crate::bit_transpose::untranspose_validity;
2222
use crate::delta::array::DeltaArrayExt;
23-
use crate::delta::array::unsigned_counterpart;
2423

2524
pub 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 {

encodings/fastlanes/src/delta/array/mod.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,6 @@ impl DeltaData {
116116
}
117117

118118
pub(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-
}

0 commit comments

Comments
 (0)