aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-06 13:41:43 -0700
committerMichael Forney <mforney@mforney.org>2024-04-06 13:44:37 -0700
commit857f0ecdab2cc3337d15540a32f5b25c1424f4de (patch)
tree648ea25c692d1992f98ffded9d783a93d5d1c25c /qbe.c
parentb7098ab7d4b48a79247679ae8d7e28a7f3bb0910 (diff)
Remove some unnecessary use of array type length
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/qbe.c b/qbe.c
index 8a19d46..8a7010a 100644
--- a/qbe.c
+++ b/qbe.c
@@ -1063,7 +1063,7 @@ emittype(struct type *t)
static unsigned id;
struct member *m, *other;
struct type *sub;
- unsigned long long i, off;
+ unsigned long long off;
if (t->value || t->kind != TYPESTRUCT && t->kind != TYPEUNION)
return;
@@ -1096,11 +1096,11 @@ emittype(struct type *t)
} else {
fputs("{ ", stdout);
}
- for (i = 1, sub = m->type; sub->kind == TYPEARRAY; sub = sub->base)
- i *= sub->u.array.length;
+ for (sub = m->type; sub->kind == TYPEARRAY; sub = sub->base)
+ ;
emitclass(qbetype(sub).data, sub->value);
- if (i > 1)
- printf(" %llu", i);
+ if (m->type->size > sub->size)
+ printf(" %llu", m->type->size / sub->size);
if (t->kind == TYPESTRUCT) {
fputs(", ", stdout);
/* skip subsequent members contained within the same storage unit */