serialize-write-bit-array-statements.j2: increment position within scope
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Sep 2020 01:52:42 +0000 (21:52 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 9 Sep 2020 01:52:42 +0000 (21:52 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/templates/c/serialize-write-bit-array-statements.j2

index 33d22490e15069e35c949612af9cecbc12cb4eba..9a2f164cdd26f6fd35717a7aaaf571c15c5b054e 100644 (file)
  # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  #}
 {% import 'common.j2' as common %}
+{% set incr_at %}ctx->at += {{ op.ft.size }}{% endset %}
 {% if op.ft.alignment % 8 == 0 and op.ft.size in [8, 16, 32, 64] %}
        {% set c_type %}uint{{ op.ft.size }}_t{% endset %}
 {
        const {{ c_type }} tmp_val = ({{ c_type }}) {{ src }};
 
        memcpy(&ctx->buf[_BITS_TO_BYTES(ctx->at)], &tmp_val, sizeof(tmp_val));
+       {{ incr_at }};
 }
-
-{% else %}
+{%- else %}
        {% set bo = 'le' if cfg.target_byte_order == barectf_config.ByteOrder.LITTLE_ENDIAN else 'be' %}
        {% set c_type_non_const = c_type | replace('const ', '') %}
 bt_bitfield_write_{{ bo }}(&ctx->buf[_BITS_TO_BYTES(ctx->at)], {{ op.offset_in_byte }}, {{ op.ft.size }},
        {{ c_type_non_const }}, ({{ c_type_non_const }}) {{ src }});
-{% endif %}
-ctx->at += {{ op.ft.size }};
+{{ incr_at }};
+{%- endif %}
This page took 0.023255 seconds and 4 git commands to generate.