commit bb0303e0e5a4a2d934f0b2b913963d4725a3e607
parent c1d7bdc899671f40e3e1e3c0a572236e67e34ada
Author: Dimitris Papastamos <dimitris.papastamos@arm.com>
Date: Fri, 12 Oct 2018 14:01:24 +0100
[scripts] Fix assert() in the generated pack/unpack wrappers
We should not be comparing against the size of the struct but against
the expected number of bits.
Change-Id: I18590e9f83efe29f4e120ef2c2c6ce47eb714e80
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/gencode.sh b/scripts/gencode.sh
@@ -69,7 +69,7 @@ function printfmt(tag,file, fmt,n,i,j,v)
}
}
-function gen(fun, tag, file)
+function gen(fun, tag, file,v,nbits)
{
file = fun "_" tag ".c"
@@ -85,7 +85,12 @@ function gen(fun, tag, file)
printfmt(tag, file)
printargs(fun, tag, "", file)
- print ");\n\n\tassert(n == sizeof(*sp));\n\n"\
+ for (i = 0; i < structs[tag]; i++) {
+ split(fields[tag, i], v, SUBSEP)
+ nbits += v[3]
+ }
+
+ print ");\n\n\tassert(n == " nbits ");\n\n"\
"\treturn n;\n"\
"}" >> file