+ if (set_native) {
+ floating_point_type->declaration.byte_order =
+ floating_point_type->declaration.byte_order == 0 ?
+ byte_order :
+ floating_point_type->declaration.byte_order;
+ floating_point_type->sign.byte_order =
+ floating_point_type->sign.byte_order == 0 ?
+ byte_order : floating_point_type->sign.byte_order;
+ floating_point_type->mantissa.byte_order =
+ floating_point_type->mantissa.byte_order == 0 ?
+ byte_order : floating_point_type->mantissa.byte_order;
+ floating_point_type->exp.byte_order =
+ floating_point_type->exp.byte_order == 0 ?
+ byte_order : floating_point_type->exp.byte_order;
+ } else {
+ floating_point_type->declaration.byte_order = byte_order;
+ floating_point_type->sign.byte_order = byte_order;
+ floating_point_type->mantissa.byte_order = byte_order;
+ floating_point_type->exp.byte_order = byte_order;
+ }
+}
+
+static
+void bt_ctf_field_type_structure_set_byte_order(struct bt_ctf_field_type *type,
+ int byte_order, int set_native)
+{
+ int i;
+ struct bt_ctf_field_type_structure *structure_type =
+ container_of(type, struct bt_ctf_field_type_structure,
+ parent);
+
+ for (i = 0; i < structure_type->fields->len; i++) {
+ struct structure_field *field = g_ptr_array_index(
+ structure_type->fields, i);
+ struct bt_ctf_field_type *field_type = field->type;
+
+ if (set_byte_order_funcs[field_type->declaration->id]) {
+ set_byte_order_funcs[field_type->declaration->id](
+ field_type, byte_order, set_native);
+ }
+ }
+}
+
+static
+void bt_ctf_field_type_variant_set_byte_order(struct bt_ctf_field_type *type,
+ int byte_order, int set_native)
+{
+ int i;
+ struct bt_ctf_field_type_variant *variant_type =
+ container_of(type, struct bt_ctf_field_type_variant,
+ parent);
+
+ for (i = 0; i < variant_type->fields->len; i++) {
+ struct structure_field *field = g_ptr_array_index(
+ variant_type->fields, i);
+ struct bt_ctf_field_type *field_type = field->type;
+
+ if (set_byte_order_funcs[field_type->declaration->id]) {
+ set_byte_order_funcs[field_type->declaration->id](
+ field_type, byte_order, set_native);
+ }
+ }
+}
+
+static
+void bt_ctf_field_type_array_set_byte_order(struct bt_ctf_field_type *type,
+ int byte_order, int set_native)
+{
+ struct bt_ctf_field_type_array *array_type =
+ container_of(type, struct bt_ctf_field_type_array,
+ parent);
+
+ if (set_byte_order_funcs[array_type->element_type->declaration->id]) {
+ set_byte_order_funcs[array_type->element_type->declaration->id](
+ array_type->element_type, byte_order, set_native);
+ }
+}
+
+static
+void bt_ctf_field_type_sequence_set_byte_order(struct bt_ctf_field_type *type,
+ int byte_order, int set_native)
+{
+ struct bt_ctf_field_type_sequence *sequence_type =
+ container_of(type, struct bt_ctf_field_type_sequence,
+ parent);
+
+ if (set_byte_order_funcs[
+ sequence_type->element_type->declaration->id]) {
+ set_byte_order_funcs[
+ sequence_type->element_type->declaration->id](
+ sequence_type->element_type, byte_order, set_native);
+ }