aboutsummaryrefslogtreecommitdiffstats
path: root/prog/analysis.go
diff options
context:
space:
mode:
Diffstat (limited to 'prog/analysis.go')
-rw-r--r--prog/analysis.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/prog/analysis.go b/prog/analysis.go
index 99f947df2..a4f399f98 100644
--- a/prog/analysis.go
+++ b/prog/analysis.go
@@ -166,7 +166,11 @@ func generateSize(arg *Arg, lenType *sys.LenType) *Arg {
return constArg(lenType, uintptr(len(arg.Inner)))
}
default:
- return constArg(lenType, arg.Size())
+ if lenType.ByteSize != 0 {
+ return constArg(lenType, arg.Size()/lenType.ByteSize)
+ } else {
+ return constArg(lenType, arg.Size())
+ }
}
}
@@ -192,6 +196,9 @@ func assignSizes(args []*Arg) {
if typ, ok := arg.Type.(*sys.LenType); ok {
if typ.Buf == "parent" {
arg.Val = parentSize
+ if typ.ByteSize != 0 {
+ arg.Val /= typ.ByteSize
+ }
continue
}