diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-08-31 19:21:52 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-08-31 19:21:52 +0200 |
| commit | 4ccdd78294694dcc56fa186d1532b285d72a4384 (patch) | |
| tree | 55ee8d412bb3d8897e8180b49669380150004ec2 /sys/align.go | |
| parent | 5a093b74f6098caf00949dcf2c2ba4c2cd9ff255 (diff) | |
sys: export struct/union attributes
Export struct/union attributes so that they can be filled in
by a different package.
Diffstat (limited to 'sys/align.go')
| -rw-r--r-- | sys/align.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/align.go b/sys/align.go index 9b9d467aa..07c13f24e 100644 --- a/sys/align.go +++ b/sys/align.go @@ -78,17 +78,17 @@ func markBitfields(t *StructType) { } func addAlignment(t *StructType) { - if t.packed { + if t.IsPacked { // If a struct is packed, statically sized and has explicitly set alignment, add a padding. - if !t.Varlen() && t.align != 0 && t.Size()%t.align != 0 { - pad := t.align - t.Size()%t.align + if !t.Varlen() && t.AlignAttr != 0 && t.Size()%t.AlignAttr != 0 { + pad := t.AlignAttr - t.Size()%t.AlignAttr t.Fields = append(t.Fields, makePad(pad)) } return } var fields []Type var off uint64 - align := t.align + align := t.AlignAttr for i, f := range t.Fields { a := f.Align() if align < a { |
