summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-22 21:10:42 +1300
committerOri Bernstein <ori@eigenstate.org>2016-05-08 17:20:43 +1200
commitfb907237536db80a21dcb82d3eb11b880db4cfcb (patch)
tree5ce9e36c2d2f9f0ae67bbe61dbfc37ca2a9c4842 /6
parent95b8caa2f3679d450a19e9b62d8eacb70e51b073 (diff)
downloadmc-fb907237536db80a21dcb82d3eb11b880db4cfcb.tar.gz
Use uvlong.
Format specifiers for precisely sized types are ugly.
Diffstat (limited to '6')
-rw-r--r--6/asm.h4
-rw-r--r--6/gengas.c14
-rw-r--r--6/genp9.c10
3 files changed, 14 insertions, 14 deletions
diff --git a/6/asm.h b/6/asm.h
index 5b8f061..25c2aca 100644
--- a/6/asm.h
+++ b/6/asm.h
@@ -77,8 +77,8 @@ struct Blob {
char isglobl;
char iscomdat;
union {
- uint64_t npad;
- uint64_t ival;
+ uvlong npad;
+ uvlong ival;
struct {
char *str;
char isextern;
diff --git a/6/gengas.c b/6/gengas.c
index d439141..04a774b 100644
--- a/6/gengas.c
+++ b/6/gengas.c
@@ -273,13 +273,13 @@ static void writeasm(FILE *fd, Isel *s, Func *fn)
}
}
-static void encodemin(FILE *fd, uint64_t val)
+static void encodemin(FILE *fd, uvlong val)
{
size_t i, shift;
uint8_t b;
if (val < 128) {
- fprintf(fd, "\t.byte %zd\n", val);
+ fprintf(fd, "\t.byte %llu\n", val);
return;
}
@@ -325,12 +325,12 @@ static void writeblob(FILE *fd, Blob *b)
}
switch (b->type) {
case Btimin: encodemin(fd, b->ival); break;
- case Bti8: fprintf(fd, "\t.byte %zd\n", b->ival); break;
- case Bti16: fprintf(fd, "\t.short %zd\n", b->ival); break;
- case Bti32: fprintf(fd, "\t.long %zd\n", b->ival); break;
- case Bti64: fprintf(fd, "\t.quad %zd\n", b->ival); break;
+ case Bti8: fprintf(fd, "\t.byte %llu\n", b->ival); break;
+ case Bti16: fprintf(fd, "\t.short %llu\n", b->ival); break;
+ case Bti32: fprintf(fd, "\t.long %llu\n", b->ival); break;
+ case Bti64: fprintf(fd, "\t.quad %llu\n", b->ival); break;
case Btbytes: writebytes(fd, b->bytes.buf, b->bytes.len); break;
- case Btpad: fprintf(fd, "\t.fill %zd,1,0\n", b->npad); break;
+ case Btpad: fprintf(fd, "\t.fill %llu,1,0\n", b->npad); break;
case Btref: fprintf(fd, "\t.quad %s + %zd\n", b->ref.str, b->ref.off); break;
case Btseq:
for (i = 0; i < b->seq.nsub; i++)
diff --git a/6/genp9.c b/6/genp9.c
index 8ad0040..b74b0aa 100644
--- a/6/genp9.c
+++ b/6/genp9.c
@@ -280,13 +280,13 @@ static void writeasm(FILE *fd, Isel *s, Func *fn)
}
}
-static size_t encodemin(FILE *fd, uint64_t val, size_t off, char *lbl)
+static size_t encodemin(FILE *fd, uvlong val, size_t off, char *lbl)
{
size_t i, shift, n;
uint8_t b;
if (val < 128) {
- fprintf(fd, "\tDATA %s+%zd(SB)/1,$%zd //x\n", lbl, off, val);
+ fprintf(fd, "\tDATA %s+%zd(SB)/1,$%llu //x\n", lbl, off, val);
return 1;
}
@@ -317,15 +317,15 @@ static size_t writeblob(FILE *fd, Blob *b, size_t off, char *lbl)
return 0;
switch (b->type) {
case Bti8:
- fprintf(fd, "\tDATA %s+%zd(SB)/1,$%zd\n", lbl, off+n, b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/1,$%llud\n", lbl, off+n, b->ival);
n += 1;
break;
case Bti16:
- fprintf(fd, "\tDATA %s+%zd(SB)/2,$%zd\n", lbl, off+n, b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/2,$%llud\n", lbl, off+n, b->ival);
n += 2;
break;
case Bti32:
- fprintf(fd, "\tDATA %s+%zd(SB)/4,$%zd\n", lbl, off+n, b->ival);
+ fprintf(fd, "\tDATA %s+%zd(SB)/4,$%llud\n", lbl, off+n, b->ival);
n += 4;
break;
case Bti64: