changeset 53:00dedefbdfd1

factdiff: print the number of bytes in each varying chunk
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 26 Jul 2013 03:15:57 +0000
parents 103d996ed2d5
children 8e4dac492552
files factdiff.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/factdiff.c	Thu Jul 25 17:06:23 2013 +0000
+++ b/factdiff.c	Fri Jul 26 03:15:57 2013 +0000
@@ -51,15 +51,20 @@
 
 output()
 {
-	int off, state, cstart;
+	int off, state, cstart, num;
 
 	for (off = 0; off < 65536; ) {
 		state = is_diff[off];
 		cstart = off;
 		while (off < 65536 && is_diff[off] == state)
 			off++;
-		printf("%04X-%04X: %s\n", cstart, off-1,
+		printf("%04X-%04X: %s", cstart, off-1,
 			state ? "varying" : "constant");
+		if (state) {
+			num = off - cstart;
+			printf(" (%d byte%s)", num, num != 1 ? "s" : "");
+		}
+		putchar('\n');
 	}
 }