From b19b9a27a0efa7d46eda31d0bb81ade955d80e99 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 18 Mar 2016 14:44:20 -0400 Subject: handle padding correctly in types --- lisc/isel.c | 8 ++++++-- lisc/lisc.h | 5 +++-- lisc/parse.c | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lisc/isel.c b/lisc/isel.c index f6d877c..e853f7b 100644 --- a/lisc/isel.c +++ b/lisc/isel.c @@ -395,10 +395,14 @@ aclass(AClass *a, Typ *t) for (e=0, s=0; e<2; e++) { cls = -1; for (n=0; n<8 && t->seg[s].len; s++) { - if (t->seg[s].flt) { + if (t->seg[s].ispad) { + /* don't change anything */ + } + else if (t->seg[s].isflt) { if (cls == -1) cls = Kd; - } else + } + else cls = Kl; n += t->seg[s].len; } diff --git a/lisc/lisc.h b/lisc/lisc.h index c730b1f..c6405ca 100644 --- a/lisc/lisc.h +++ b/lisc/lisc.h @@ -435,8 +435,9 @@ struct Typ { int align; struct { - uint flt:1; - uint len:31; + uint isflt:1; + uint ispad:1; + uint len:30; } seg[NSeg+1]; }; diff --git a/lisc/parse.c b/lisc/parse.c index 43787c2..bf509d1 100644 --- a/lisc/parse.c +++ b/lisc/parse.c @@ -745,7 +745,7 @@ parsetyp() a = s - a; if (++n < NSeg) { /* padding segment */ - ty->seg[n].flt = 0; + ty->seg[n].ispad = 1; ty->seg[n].len = a; } } @@ -757,7 +757,8 @@ parsetyp() c = 1; while (c-- > 0) { if (++n < NSeg) { - ty->seg[n].flt = flt; + ty->seg[n].isflt = flt; + ty->seg[n].ispad = 0; ty->seg[n].len = s; } sz += a + s; -- cgit 1.4.1