1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:24:39 -07:00

Use BitSize instead of the field's type native ByteSize when calculating

structs containing bitfields.

Fixes #163.

R=rsc
CC=golang-dev
https://golang.org/cl/180059
This commit is contained in:
Devon H. O'Dell 2009-12-17 12:38:29 -08:00 committed by Russ Cox
parent a812332151
commit 7a5f4be97e

View File

@ -693,6 +693,9 @@ func (c *typeConv) Struct(dt *dwarf.StructType) (expr *ast.StructType, csyntax s
}
for _, f := range dt.Field {
if f.BitSize > 0 && f.BitSize != f.ByteSize*8 {
continue
}
if f.ByteOffset > off {
fld = c.pad(fld, f.ByteOffset-off)
off = f.ByteOffset