summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-03-26 22:09:07 +0100
committerJesper Jensen <jesper@jnsn.dev>2025-03-26 22:09:07 +0100
commit93f5f167aac043e68d7988e4fcf8003ba43bf9d5 (patch)
tree50ee950bb9b78d33d6819c76a7a782e2393b0b9d /cmd
parentad76589898e84732ada3a3cc8fcbbd0cba6083c5 (diff)
Start trying to merge the files back to a diff
Diffstat (limited to 'cmd')
-rw-r--r--cmd/main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmd/main.c b/cmd/main.c
index 797e043..058bfe1 100644
--- a/cmd/main.c
+++ b/cmd/main.c
@@ -144,5 +144,30 @@ int main(int argc, char **argv) {
}
loge();
+ size_t a_chunk = 0;
+ size_t b_chunk = 0;
+
+ for(size_t i = 0; i < b_tree.len; i++) {
+ size_t bc_len = b_chunks[b_chunk+1] - b_chunks[b_chunk];
+
+ /* log("Dumping a from %ld until %d", a_chunk, alignment[i]); */
+ while(a_chunk + 1 < alignment[i]) {
+ size_t ac_len = a_chunks[a_chunk+1] - a_chunks[a_chunk];
+ fwrite(a + a_chunks[a_chunk], ac_len, 1, stdout);
+ a_chunk++;
+ }
+
+ if(alignment[i] == 0) {
+ /* log("Alignment says %ld was created", b_chunk); */
+ fwrite(b + b_chunks[b_chunk], bc_len, 1, stdout);
+ } else {
+ /* log("Alignment says %ld matches with %ld", b_chunk, a_chunk); */
+ fwrite(b + b_chunks[b_chunk], bc_len, 1, stdout);
+ a_chunk++;
+ }
+
+ b_chunk++;
+ }
+
return 0;
}