pyloxi: slightly generalize alignment
The _pack and _unpack templates should not be matching on particular class
names. Move the decision up a few levels to codegen.
diff --git a/py_gen/templates/generic_util.py b/py_gen/templates/generic_util.py
index eca828c..28d3b5f 100644
--- a/py_gen/templates/generic_util.py
+++ b/py_gen/templates/generic_util.py
@@ -109,6 +109,12 @@
raise loxi.ProtocolError("Buffer too short")
self.offset += length
+ def skip_align(self):
+ new_offset = (self.offset + 7) / 8 * 8
+ if new_offset > len(self.buf):
+ raise loxi.ProtocolError("Buffer too short")
+ self.offset = new_offset
+
def is_empty(self):
return self.offset == len(self.buf)