aboutsummaryrefslogtreecommitdiffstats
path: root/prog/analysis.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-12-18 18:30:39 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-12-19 19:32:45 +0100
commit20c6855484620eda011e4e4002c6f7f272a878c4 (patch)
treee8143cbd4d72702e02a91cd68883c7117681954b /prog/analysis.go
parentaf9047c60a3db32d5e43c29321f8f531db051a63 (diff)
prog: refactor bitfields representation
All callers of BitfieldMiddle just want static size (0 for middle). Make it so: Size for middle bitfields just returns 0. Removes lots of if's. Introduce Type.UnitSize, which now holds the underlying type for bitfields. This will be needed to fix #1542 b/c even if UnitSize=4 for last bitfield Size can be anywhere from 0 to 4 (not necessary equal to UnitSize due to overlapping).
Diffstat (limited to 'prog/analysis.go')
-rw-r--r--prog/analysis.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/prog/analysis.go b/prog/analysis.go
index f8330ed1c..519d5ba84 100644
--- a/prog/analysis.go
+++ b/prog/analysis.go
@@ -134,11 +134,9 @@ func foreachArgImpl(arg Arg, ctx ArgCtx, f func(Arg, *ArgCtx)) {
var totalSize uint64
for _, arg1 := range a.Inner {
foreachArgImpl(arg1, ctx, f)
- if !arg1.Type().BitfieldMiddle() {
- size := arg1.Size()
- ctx.Offset += size
- totalSize += size
- }
+ size := arg1.Size()
+ ctx.Offset += size
+ totalSize += size
}
claimedSize := a.Size()
varlen := a.Type().Varlen()