mirror of
https://github.com/golang/go
synced 2024-11-25 22:57:58 -07:00
change array padding in structures
to pad to size of element rather than size of array. R=r OCL=24641 CL=24641
This commit is contained in:
parent
8a70545b57
commit
56003374d3
@ -50,18 +50,28 @@ offmod(Type *t)
|
||||
}
|
||||
}
|
||||
|
||||
uint32
|
||||
arrayelemwidth(Type *t)
|
||||
{
|
||||
|
||||
while(t->etype == TARRAY && t->bound >= 0)
|
||||
t = t->type;
|
||||
return t->width;
|
||||
}
|
||||
|
||||
uint32
|
||||
widstruct(Type *t, uint32 o, int flag)
|
||||
{
|
||||
Type *f;
|
||||
int32 w;
|
||||
int32 w, m;
|
||||
|
||||
for(f=t->type; f!=T; f=f->down) {
|
||||
if(f->etype != TFIELD)
|
||||
fatal("widstruct: not TFIELD: %lT", f);
|
||||
dowidth(f->type);
|
||||
w = f->type->width;
|
||||
o = rnd(o, w);
|
||||
m = arrayelemwidth(f->type);
|
||||
o = rnd(o, m);
|
||||
f->width = o; // really offset for TFIELD
|
||||
o += w;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user