java_gen: correctly handle of_action 64-bit alignment
of_action is different from oxm in that it is 64 bit aligned,
but the alignment is contained in the length field.
Added optional parameter "length_includes_align" to the input files
to handle this situation.
diff --git a/java_gen/templates/of_class.java b/java_gen/templates/of_class.java
index ef927fd..46dc1ea 100644
--- a/java_gen/templates/of_class.java
+++ b/java_gen/templates/of_class.java
@@ -327,10 +327,13 @@
//:: if not msg.is_fixed_length:
// update length field
int length = bb.writerIndex() - startIndex;
- bb.setShort(lengthIndex, length);
+ //:: if msg.align:
+ int alignedLength = ((length + ${msg.align-1})/${msg.align} * ${msg.align});
+ //:: #endif
+ bb.setShort(lengthIndex, ${"alignedLength" if msg.length_includes_align else "length"});
//:: if msg.align:
// align message to ${msg.align} bytes
- bb.writeZero( ((length + ${msg.align-1})/${msg.align} * ${msg.align}) - length);
+ bb.writeZero(alignedLength - length);
//:: #endif
//:: #end