Push mtzqmmrlmzzx #34

Merged
coissac merged 25 commits from push-mtzqmmrlmzzx into main 2026-06-22 08:47:24 +00:00
3 changed files with 11 additions and 1 deletions
Showing only changes of commit 26de90f18d - Show all commits
+7 -1
View File
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use memmap2::MmapMut;
use crate::format::{HEADER_SIZE, finalize_pciv, parse_overflow_entry};
use crate::format::{byte_count_nonzero, byte_sum, HEADER_SIZE, finalize_pciv, parse_overflow_entry};
use crate::reader::PersistentCompactIntVec;
pub struct PersistentCompactIntVecBuilder {
@@ -148,6 +148,12 @@ impl IntSlice for PersistentCompactIntVecBuilder {
fn overflow_entries(&self) -> impl Iterator<Item = (usize, u32)> + '_ {
self.overflow.iter().map(|(&k, &v)| (k, v))
}
fn sum(&self) -> u64 {
byte_sum(&self.mmap[HEADER_SIZE..HEADER_SIZE + self.n], self.overflow.values().copied())
}
fn count_nonzero(&self) -> u64 {
byte_count_nonzero(&self.mmap[HEADER_SIZE..HEADER_SIZE + self.n])
}
}
impl IntSliceMut for PersistentCompactIntVecBuilder {
+1
View File
@@ -80,6 +80,7 @@ impl IntSlice for MemoryIntVec {
fn overflow_entries(&self) -> impl Iterator<Item = (usize, u32)> + '_ {
self.overflow.iter().map(|(&k, &v)| (k, v))
}
fn iter(&self) -> impl Iterator<Item = u32> + '_ { self.iter() }
fn sum(&self) -> u64 { self.sum() }
fn count_nonzero(&self) -> u64 { self.count_nonzero() }
}
+3
View File
@@ -363,6 +363,9 @@ impl IntSlice for PersistentCompactIntVec {
fn overflow_entries(&self) -> impl Iterator<Item = (usize, u32)> + '_ {
(0..self.n_overflow).map(|i| (self.data_slot(i), self.data_value(i)))
}
fn iter(&self) -> impl Iterator<Item = u32> + '_ { self.iter() }
fn sum(&self) -> u64 { self.sum() }
fn count_nonzero(&self) -> u64 { self.count_nonzero() }
}
impl<'a> IntoIterator for &'a PersistentCompactIntVec {