- align_pos(src, float_class->p.alignment);
- align_pos(dest, float_class->p.alignment);
- _ctf_float_copy(dest, float_class, src, float_class);
+ struct definition_float *float_definition =
+ container_of(definition, struct definition_float, p);
+ const struct declaration_float *float_declaration =
+ float_definition->declaration;
+ struct ctf_stream_pos *pos = ctf_pos(ppos);
+ union doubleIEEE754 u;
+ struct definition *tmpdef;
+ struct definition_float *tmpfloat;
+ struct ctf_stream_pos destp;
+ int ret;
+
+ switch (float_declaration->mantissa->len + 1) {
+ case FLT_MANT_DIG:
+ tmpdef = static_float_declaration->p.definition_new(
+ &static_float_declaration->p,
+ NULL, 0, 0, "__tmpfloat");
+ break;
+ case DBL_MANT_DIG:
+ tmpdef = static_double_declaration->p.definition_new(
+ &static_double_declaration->p,
+ NULL, 0, 0, "__tmpfloat");
+ break;
+ default:
+ return -EINVAL;
+ }
+ tmpfloat = container_of(tmpdef, struct definition_float, p);
+ ctf_init_pos(&destp, -1, O_RDWR);
+ destp.base = (char *) u.bits;
+ destp.packet_size = sizeof(u) * CHAR_BIT;
+ ctf_align_pos(pos, float_declaration->p.alignment);
+ ret = _ctf_float_copy(&destp.parent, tmpfloat, ppos, float_definition);
+ switch (float_declaration->mantissa->len + 1) {
+ case FLT_MANT_DIG:
+ float_definition->value = u.vf;
+ break;
+ case DBL_MANT_DIG:
+ float_definition->value = u.vd;
+ break;
+ default:
+ return -EINVAL;
+ }
+ definition_unref(tmpdef);
+ return ret;