aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-01-17 18:55:06 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-01-18 13:07:53 +0100
commit11fa77cbbed73f018515d2ec5c6bff4123aa763a (patch)
tree18537dd3ac9a9558c3754c13fd5a19024838cf15 /sys
parentab500f0861124519ca4001a83c4e8752c6b3f3cb (diff)
prog, sys: fix struct with bitfields size calculation
Diffstat (limited to 'sys')
-rw-r--r--sys/decl.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/decl.go b/sys/decl.go
index 6c756fa07..d16534a7f 100644
--- a/sys/decl.go
+++ b/sys/decl.go
@@ -303,7 +303,9 @@ func (t *StructType) Size() uintptr {
}
var size uintptr
for _, f := range t.Fields {
- size += f.Size()
+ if f.BitfieldLength() == 0 || f.BitfieldLast() {
+ size += f.Size()
+ }
}
return size
}