FreeCalypso > hg > freecalypso-reveng
comparison factdiff.c @ 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 |
comparison
equal
deleted
inserted
replaced
52:103d996ed2d5 | 53:00dedefbdfd1 |
---|---|
49 is_diff[i] = 1; | 49 is_diff[i] = 1; |
50 } | 50 } |
51 | 51 |
52 output() | 52 output() |
53 { | 53 { |
54 int off, state, cstart; | 54 int off, state, cstart, num; |
55 | 55 |
56 for (off = 0; off < 65536; ) { | 56 for (off = 0; off < 65536; ) { |
57 state = is_diff[off]; | 57 state = is_diff[off]; |
58 cstart = off; | 58 cstart = off; |
59 while (off < 65536 && is_diff[off] == state) | 59 while (off < 65536 && is_diff[off] == state) |
60 off++; | 60 off++; |
61 printf("%04X-%04X: %s\n", cstart, off-1, | 61 printf("%04X-%04X: %s", cstart, off-1, |
62 state ? "varying" : "constant"); | 62 state ? "varying" : "constant"); |
63 if (state) { | |
64 num = off - cstart; | |
65 printf(" (%d byte%s)", num, num != 1 ? "s" : ""); | |
66 } | |
67 putchar('\n'); | |
63 } | 68 } |
64 } | 69 } |
65 | 70 |
66 main(argc, argv) | 71 main(argc, argv) |
67 char **argv; | 72 char **argv; |