diff --git a/src/ddsketch.rs b/src/ddsketch.rs index a408533..8133aa8 100644 --- a/src/ddsketch.rs +++ b/src/ddsketch.rs @@ -47,6 +47,12 @@ pub struct DDSketch { zero_count: u64, } +impl Default for DDSketch { + fn default() -> Self { + Self::new(Default::default()) + } +} + // XXX: functions should return Option<> in the case of empty impl DDSketch { /// Construct a `DDSketch`. Requires a `Config` specifying the parameters of the sketch diff --git a/src/store.rs b/src/store.rs index 8fe2b6b..66217f8 100644 --- a/src/store.rs +++ b/src/store.rs @@ -174,7 +174,7 @@ impl Store { } pub fn count(&self) -> u64 { - self.count as u64 + self.count } pub fn merge(&mut self, other: &Store) { @@ -203,7 +203,7 @@ impl Store { collapse_end_index = collapse_start_index; } - for key in (collapse_end_index as i32 + other.offset)..(other.max_key + 1) { + for key in (collapse_end_index + other.offset)..(other.max_key + 1) { self.bins[(key - self.offset) as usize] += other.bins[(key - other.offset) as usize] }