aboutsummaryrefslogtreecommitdiff
path: root/sketch.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-08-31 16:28:07 +0200
committern-peugnet <n.peugnet@free.fr>2021-08-31 16:38:34 +0200
commit504fe3db47c058807b656a8e63bb27c12420f268 (patch)
tree5fec35a147b3234633d237601cc49627fbedf331 /sketch.go
parentc481eb2b44adf50b62de3b9e3355f64973967d52 (diff)
downloaddna-backup-504fe3db47c058807b656a8e63bb27c12420f268.tar.gz
dna-backup-504fe3db47c058807b656a8e63bb27c12420f268.zip
join too small temp chunks with previous one if possible
Diffstat (limited to 'sketch.go')
-rw-r--r--sketch.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/sketch.go b/sketch.go
index 9910848..c88f043 100644
--- a/sketch.go
+++ b/sketch.go
@@ -16,7 +16,7 @@ const fBytes = 8
// sfCount: the number of super-features, and fCount: the number of feature
// per super-feature
func SketchChunk(chunk Chunk, wSize int, sfCount int, fCount int) (Sketch, error) {
- var fSize = chunkSize / (sfCount * fCount)
+ var fSize = FeatureSize(chunkSize, sfCount, fCount)
superfeatures := make([]uint64, 0, sfCount)
features := make([]uint64, 0, fCount*sfCount)
buff := make([]byte, fBytes*fCount)
@@ -49,3 +49,11 @@ func SketchChunk(chunk Chunk, wSize int, sfCount int, fCount int) (Sketch, error
}
return superfeatures, nil
}
+
+func SuperFeatureSize(chunkSize int, sfCount int, fCount int) int {
+ return FeatureSize(chunkSize, sfCount, fCount) * sfCount
+}
+
+func FeatureSize(chunkSize int, sfCount int, fCount int) int {
+ return chunkSize / (sfCount * fCount)
+}