#ifndef _{{ ucprefix }}BITFIELD_H
#define _{{ ucprefix }}BITFIELD_H
+#include <stdint.h>
+
/*
* BabelTrace
*
* Also, consecutive bitfields are placed from higher to lower bits.
*/
+{% if cfg.target_byte_order == barectf_config.ByteOrder.LITTLE_ENDIAN %}
+/* Target byte order: little-endian */
+
#define _bt_bitfield_write_le(_ptr, type, _start, _length, _vtype, _v) \
do { \
_vtype __v = (_v); \
__ptr[this_unit] = (type) __v; \
} while (0)
+#define bt_bitfield_write_le(ptr, _start, _length, _vtype, _v) \
+ _bt_bitfield_write_le(ptr, uint8_t, _start, _length, _vtype, _v)
+{% else %}
+/* Target byte order: big-endian */
+
#define _bt_bitfield_write_be(_ptr, type, _start, _length, _vtype, _v) \
do { \
_vtype __v = (_v); \
__ptr[this_unit] = (type) __v; \
} while (0)
-{% if cfg.target_byte_order == barectf_config.ByteOrder.LITTLE_ENDIAN %}
-/* Target byte order: little-endian */
-#define bt_bitfield_write_le(ptr, type, _start, _length, _vtype, _v) \
- _bt_bitfield_write_le(ptr, type, _start, _length, _vtype, _v)
-#define bt_bitfield_write_be(ptr, type, _start, _length, _vtype, _v) \
- _bt_bitfield_write_be(ptr, unsigned char, _start, _length, _vtype, _v)
-{% else %}
-/* Target byte order: big-endian */
-#define bt_bitfield_write_le(ptr, type, _start, _length, _vtype, _v) \
- _bt_bitfield_write_le(ptr, unsigned char, _start, _length, _vtype, _v)
-#define bt_bitfield_write_be(ptr, type, _start, _length, _vtype, _v) \
- _bt_bitfield_write_be(ptr, type, _start, _length, _vtype, _v)
+#define bt_bitfield_write_be(ptr, _start, _length, _vtype, _v) \
+ _bt_bitfield_write_be(ptr, uint8_t, _start, _length, _vtype, _v)
{% endif %}
#endif /* _{{ ucprefix }}BITFIELD_H */
{% import 'common.j2' as common %}
{% 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)],
- uint8_t, {{ op.offset_in_byte }}, {{ op.ft.size }}, {{ c_type_non_const }},
- ({{ c_type_non_const }}) {{ src }});
+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 }});
ctx->at += {{ op.ft.size }};