From a548d9d0f7b889627c43b18811357fad88760b2d Mon Sep 17 00:00:00 2001 From: aarzilli Date: Fri, 2 May 2014 15:09:23 +0200 Subject: Fix Issue #21: automatic calculation of alignment padding after lists --- nexgb/xgbgen/request_reply.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nexgb/xgbgen/request_reply.go') diff --git a/nexgb/xgbgen/request_reply.go b/nexgb/xgbgen/request_reply.go index 11a4e44..ae4eccb 100644 --- a/nexgb/xgbgen/request_reply.go +++ b/nexgb/xgbgen/request_reply.go @@ -91,7 +91,7 @@ func (r *Request) CookieName() string { // If it's a core protocol request, then we only account for *three* // bytes of the header (remove the extension opcode). func (r *Request) Size(c *Context) Size { - size := newFixedSize(0) + size := newFixedSize(0, true) // If this is a core protocol request, we squeeze in an extra byte of // data (from the fields below) between the opcode and the size of the @@ -99,9 +99,9 @@ func (r *Request) Size(c *Context) Size { // by the opcode of the request (while the first byte is always occupied // by the opcode of the extension). if !c.protocol.isExt() { - size = size.Add(newFixedSize(3)) + size = size.Add(newFixedSize(3, true)) } else { - size = size.Add(newFixedSize(4)) + size = size.Add(newFixedSize(4, true)) } for _, field := range r.Fields { @@ -122,7 +122,7 @@ func (r *Request) Size(c *Context) Size { } return newExpressionSize(&Padding{ Expr: size.Expression, - }) + }, size.exact) } // Reply encapsulates the fields associated with a 'reply' element. @@ -136,10 +136,10 @@ type Reply struct { // 2 bytes: A sequence number // 4 bytes: Number of additional bytes in 4-byte units past initial 32 bytes. func (r *Reply) Size() Size { - size := newFixedSize(0) + size := newFixedSize(0, true) // Account for reply discriminant, sequence number and reply length - size = size.Add(newFixedSize(7)) + size = size.Add(newFixedSize(7, true)) for _, field := range r.Fields { size = size.Add(field.Size()) -- cgit v1.2.3