Skip to content

Commit c2580f0

Browse files
committed
use zero as fill value if the entire chunk is patches
1 parent f4ef3cc commit c2580f0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

encodings/alp/src/alp/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod private {
3535
}
3636

3737
pub trait ALPFloat: private::Sealed + Float + Display + 'static {
38-
type ALPInt: PrimInt + Display + ToPrimitive + Copy;
38+
type ALPInt: PrimInt + Display + ToPrimitive + Copy + Default;
3939

4040
const FRACTIONAL_BITS: u8;
4141
const MAX_EXPONENT: u8;
@@ -164,13 +164,11 @@ pub trait ALPFloat: private::Sealed + Float + Display + 'static {
164164
.collect();
165165

166166
if !patch_indices.is_empty() {
167-
if let Some(fill_value) =
168-
Self::first_non_patched_encoded_value(&encoded, &patch_indices)
169-
{
170-
for index in patch_indices.iter() {
171-
let index = *index as usize;
172-
encoded[index] = fill_value;
173-
}
167+
let fill_value =
168+
Self::first_non_patched_encoded_value(&encoded, &patch_indices).unwrap_or_default();
169+
for index in patch_indices.iter() {
170+
let index = *index as usize;
171+
encoded[index] = fill_value;
174172
}
175173
}
176174

0 commit comments

Comments
 (0)