summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python/vpp_papi
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-08-02 19:19:21 +0200
committerDave Barach <openvpp@barachs.net>2018-08-03 15:44:46 +0000
commitb199e98fef4256795db7fb055b180a07ce84de5c (patch)
tree079a1f975f7cddb1d64c0107495faba2f5c8f821 /src/vpp-api/python/vpp_papi
parentb257fc9fc2558139ec315754e98a57cebb358ed4 (diff)
PAPI: Union pad at the end of short fields instead of at head.
Hopefully that's going to be consistent across platforms, compilers and ABI. Change-Id: I0b82565288d88fd046278d4d8288ec1488273ba5 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_serializer.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py
index 9b30d5caa56..cd9a281964a 100644
--- a/src/vpp-api/python/vpp_papi/vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py
@@ -232,17 +232,15 @@ class VPPUnionType():
for k, v in data.items():
logger.debug("Key: {} Value: {}".format(k, v))
b = self.packers[k].pack(v, kwargs)
- offset = self.size - self.packers[k].size
break
r = bytearray(self.size)
- r[offset:] = b
+ r[:len(b)] = b
return r
def unpack(self, data, offset=0, result=None):
r = []
for k, p in self.packers.items():
- union_offset = self.size - p.size
- r.append(p.unpack(data, offset + union_offset))
+ r.append(p.unpack(data, offset))
return self.tuple._make(r)