Fixed the union code generation: if the union contained a power of two number of items, the tag bit length was one higher than needed, causing incorrect serialization.

This commit is contained in:
Pavel Kirienko
2018-05-19 17:39:26 +03:00
parent d036cb3f5c
commit 94c0374165
@@ -70,7 +70,7 @@ struct UAVCAN_EXPORT ${t.cpp_type_name}
};
};
typedef ::uavcan::IntegerSpec< ::uavcan::IntegerBitLen< ${len(fields)} >::Result,
typedef ::uavcan::IntegerSpec< ::uavcan::IntegerBitLen< ${len(fields)}U - 1U >::Result,
::uavcan::SignednessUnsigned, ::uavcan::CastModeTruncate > TagType;
<!--(macro expand_enum_per_field)--> #! enum_name, enum_comparator