summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-08-06 02:14:56 -0400
committerOri Bernstein <ori@eigenstate.org>2012-08-06 02:14:56 -0400
commitb1c03eec08fe0d951121ead8f1c52c8271e4d420 (patch)
treebbabbb0b732457a56e4b82afaf0a4a5209c1d111 /6
parentf5c2360f5f40876545752c7874cd1286baf34234 (diff)
downloadmc-b1c03eec08fe0d951121ead8f1c52c8271e4d420.tar.gz
Use .byte constants. At least that seems to work cross platform.
Diffstat (limited to '6')
-rw-r--r--6/isel.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/6/isel.c b/6/isel.c
index 76ee6b5..87d376c 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -815,20 +815,25 @@ static Asmbb *mkasmbb(Bb *bb)
return as;
}
+#define Nper 30
static void writeblob(FILE *fd, char *p, size_t sz)
{
size_t i;
+ char sep;
for (i = 0; i < sz; i++) {
- if (i % 60 == 0)
- fprintf(fd, "\t.ascii \"");
+ if (i % Nper == 0) {
+ sep = ' ';
+ fprintf(fd, "\t.byte");
+ }
if (isprint(p[i]))
- fprintf(fd, "%c", p[i]);
+ fprintf(fd, "%c'%c'", sep, p[i]);
else
- fprintf(fd, "\\x%x", p[i] & 0xff);
+ fprintf(fd, "%c0x%x", sep, (unsigned)p[i] & 0xff);
/* line wrapping for readability */
- if (i % 60 == 59 || i == sz - 1)
- fprintf(fd, "\"\n");
+ if (i % Nper == Nper - 1 || i == sz - 1)
+ fprintf(fd, "\n");
+ sep = ',';
}
}