From 4ccdd78294694dcc56fa186d1532b285d72a4384 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 31 Aug 2017 19:21:52 +0200 Subject: sys: export struct/union attributes Export struct/union attributes so that they can be filled in by a different package. --- sys/align.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/align.go') 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 { -- cgit mrf-deployment