diff options
author | Michael Forney <mforney@mforney.org> | 2021-09-29 14:41:59 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2021-09-29 14:41:59 -0700 |
commit | 55395c5e81f8769315888bee61b67e6bbf5da5eb (patch) | |
tree | 205855a57111431aaa14fb9992124d37ad98698f | |
parent | e196f1607a9f07198653431681617a601edc07f3 (diff) |
Use unsigned long long for sizes and offsets
We don't need exact-width integer types here.
-rw-r--r-- | cc.h | 14 | ||||
-rw-r--r-- | decl.c | 8 | ||||
-rw-r--r-- | expr.c | 6 | ||||
-rw-r--r-- | init.c | 8 | ||||
-rw-r--r-- | qbe.c | 4 | ||||
-rw-r--r-- | type.c | 4 |
6 files changed, 22 insertions, 22 deletions
@@ -191,7 +191,7 @@ struct member { char *name; struct type *type; enum typequal qual; - uint64_t offset; + unsigned long long offset; struct bitfield bits; struct member *next; }; @@ -200,7 +200,7 @@ struct type { enum typekind kind; enum typeprop prop; int align; - uint64_t size; + unsigned long long size; struct value *value; /* used by the backend */ union { struct type *base; @@ -214,7 +214,7 @@ struct type { _Bool issigned, iscomplex; } basic; struct { - uint64_t length; + unsigned long long length; } array; struct { _Bool isprototype, isvararg, isnoreturn, paraminfo; @@ -368,7 +368,7 @@ struct expr { }; struct init { - uint64_t start, end; + unsigned long long start, end; struct expr *expr; struct bitfield bits; struct init *next; @@ -410,7 +410,7 @@ _Bool consume(int); struct type *mktype(enum typekind, enum typeprop); struct type *mkpointertype(struct type *, enum typequal); -struct type *mkarraytype(struct type *, enum typequal, uint64_t); +struct type *mkarraytype(struct type *, enum typequal, unsigned long long); _Bool typecompatible(struct type *, struct type *); _Bool typesame(struct type *, struct type *); @@ -420,7 +420,7 @@ struct type *typecommonreal(struct type *, unsigned, struct type *, unsigned); struct type *typepromote(struct type *, unsigned); struct type *typeadjust(struct type *); enum typeprop typeprop(struct type *); -struct member *typemember(struct type *, const char *, uint64_t *); +struct member *typemember(struct type *, const char *, unsigned long long *); struct param *mkparam(char *, struct type *, enum typequal); @@ -493,7 +493,7 @@ struct expr *eval(struct expr *, enum evalkind); /* init */ -struct init *mkinit(uint64_t, uint64_t, struct bitfield, struct expr *); +struct init *mkinit(unsigned long long, unsigned long long, struct bitfield, struct expr *); struct init *parseinit(struct scope *, struct type *); void stmt(struct func *, struct scope *); @@ -261,7 +261,7 @@ declspecs(struct scope *s, enum storageclass *sc, enum funcspec *fs, int *align) enum typespec ts = SPECNONE; enum typequal tq = QUALNONE; int ntypes = 0; - uint64_t i; + unsigned long long i; t = NULL; if (sc) @@ -464,7 +464,7 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs struct type *t; struct param **p; struct expr *e; - uint64_t i; + unsigned long long i; enum typequal tq; while (consume(TMUL)) { @@ -664,7 +664,7 @@ paramdecl(struct scope *s, struct param *params) } static void -addmember(struct structbuilder *b, struct qualtype mt, char *name, int align, uint64_t width) +addmember(struct structbuilder *b, struct qualtype mt, char *name, int align, unsigned long long width) { struct type *t = b->type; struct member *m; @@ -774,7 +774,7 @@ structdecl(struct scope *s, struct structbuilder *b) { struct qualtype base, mt; char *name; - uint64_t width; + unsigned long long width; int align; if (staticassert(s)) @@ -553,7 +553,7 @@ static struct expr *condexpr(struct scope *); /* TODO: merge with init.c:designator() */ static void -designator(struct scope *s, struct type *t, uint64_t *offset) +designator(struct scope *s, struct type *t, unsigned long long *offset) { char *name; struct member *m; @@ -594,7 +594,7 @@ builtinfunc(struct scope *s, enum builtinkind kind) struct type *t; struct member *m; char *name; - uint64_t offset; + unsigned long long offset; switch (kind) { case BUILTINALLOCA: @@ -717,7 +717,7 @@ postfixexpr(struct scope *s, struct expr *r) struct type *t; struct param *p; struct member *m; - uint64_t offset; + unsigned long long offset; enum typequal tq; enum tokenkind op; bool lvalue; @@ -7,7 +7,7 @@ #include "cc.h" struct object { - uint64_t offset; + unsigned long long offset; struct type *type; union { struct member *mem; @@ -24,7 +24,7 @@ struct initparser { }; struct init * -mkinit(uint64_t start, uint64_t end, struct bitfield bits, struct expr *expr) +mkinit(unsigned long long start, unsigned long long end, struct bitfield bits, struct expr *expr) { struct init *init; @@ -64,7 +64,7 @@ initadd(struct initparser *p, struct init *new) } static void -updatearray(struct type *t, uint64_t i) +updatearray(struct type *t, unsigned long long i) { if (!t->incomplete) return; @@ -75,7 +75,7 @@ updatearray(struct type *t, uint64_t i) } static void -subobj(struct initparser *p, struct type *t, uint64_t off) +subobj(struct initparser *p, struct type *t, unsigned long long off) { off += p->sub->offset; if (++p->sub == p->obj + LEN(p->obj)) @@ -1128,7 +1128,7 @@ emittype(struct type *t) fputs("type ", stdout); emitvalue(t->value); if (t == targ->typevalist) { - printf(" = align %d { %" PRIu64 " }\n", t->align, t->size); + printf(" = align %d { %llu }\n", t->align, t->size); return; } fputs(" = { ", stdout); @@ -1427,6 +1427,6 @@ emitdata(struct decl *d, struct init *init) } assert(offset <= d->type->size); if (offset < d->type->size) - printf("z %" PRIu64 " ", d->type->size - offset); + printf("z %llu ", d->type->size - offset); puts("}"); } @@ -71,7 +71,7 @@ mkpointertype(struct type *base, enum typequal qual) } struct type * -mkarraytype(struct type *base, enum typequal qual, uint64_t len) +mkarraytype(struct type *base, enum typequal qual, unsigned long long len) { struct type *t; @@ -235,7 +235,7 @@ typeadjust(struct type *t) } struct member * -typemember(struct type *t, const char *name, uint64_t *offset) +typemember(struct type *t, const char *name, unsigned long long *offset) { struct member *m, *sub; |