summaryrefslogtreecommitdiff
path: root/distribute.c
diff options
context:
space:
mode:
Diffstat (limited to 'distribute.c')
-rw-r--r--distribute.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/distribute.c b/distribute.c
index d2d1eff..7c2b49f 100644
--- a/distribute.c
+++ b/distribute.c
@@ -1,9 +1,12 @@
#include <stddef.h>
#include "common.h"
+#include "counts.h"
void distribute_buffer(char *base, size_t bufnmel, size_t sortnmel, size_t width, cmpfun cmp)
{
+ struct counts snapshot = counts[CURRENT];
+
while (bufnmel && sortnmel) {
char *sorted = base + bufnmel * width;
size_t insertpos = binary_search(base, sorted, sortnmel, width, cmp);
@@ -15,4 +18,6 @@ void distribute_buffer(char *base, size_t bufnmel, size_t sortnmel, size_t width
bufnmel -= 1;
sortnmel -= insertpos;
}
+
+ add_counts(counts + DISTRIBUTE, &snapshot);
}