summaryrefslogtreecommitdiff
path: root/6/blob.c
diff options
context:
space:
mode:
Diffstat (limited to '6/blob.c')
-rw-r--r--6/blob.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/6/blob.c b/6/blob.c
index 46072a1..8e2671e 100644
--- a/6/blob.c
+++ b/6/blob.c
@@ -255,15 +255,17 @@ blobstruct(Blob *seq, Htab *globls, Htab *strtab, Node *n)
static size_t
blobucon(Blob *seq, Htab *globls, Htab *strtab, Node *n)
{
- size_t sz, pad;
+ size_t sz, align;
Ucon *uc;
sz = 4;
uc = finducon(exprtype(n), n->expr.args[0]);
b(seq, mkblobi(Bti32, uc->id));
+ align = 1;
if (n->expr.nargs > 1) {
- pad = tyalign(exprtype(n->expr.args[1])) - sz;
- sz += blobpad(seq, pad);
+ align = tyalign(exprtype(n->expr.args[1]));
+ if (align > sz)
+ sz += blobpad(seq, align - sz);
sz += blobrec(seq, globls, strtab, n->expr.args[1]);
}
sz += blobpad(seq, size(n) - sz);