From 551c2aa7e421a329397f97aff5fb7be9a76f4398 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Mon, 19 Sep 2016 16:43:44 +0200 Subject: sys: delete Size() and Align() methods for struct and union --- sys/decl.go | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'sys') diff --git a/sys/decl.go b/sys/decl.go index a447948bc..a9f9d1ad3 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -276,27 +276,11 @@ type StructType struct { } func (t *StructType) Size() uintptr { - if !t.padded { - panic("struct is not padded yet") - } - var size uintptr - for _, f := range t.Fields { - size += f.Size() - } - return size + panic("not called") } func (t *StructType) Align() uintptr { - if t.align != 0 { - return t.align // overrided by user attribute - } - var align uintptr - for _, f := range t.Fields { - if a1 := f.Align(); align < a1 { - align = a1 - } - } - return align + panic("not called") } type UnionType struct { @@ -306,26 +290,11 @@ type UnionType struct { } func (t *UnionType) Size() uintptr { - if t.varlen { - panic("union size is not statically known") - } - size := t.Options[0].Size() - for _, opt := range t.Options { - if size < opt.Size() { - size = opt.Size() - } - } - return size + panic("not called") } func (t *UnionType) Align() uintptr { - var align uintptr - for _, opt := range t.Options { - if a1 := opt.Align(); align < a1 { - align = a1 - } - } - return align + panic("not called") } type Dir int -- cgit mrf-deployment