diff --git a/opal/dss/dss_pack.c b/opal/dss/dss_pack.c index 764ec2cb05..595a4d3209 100644 --- a/opal/dss/dss_pack.c +++ b/opal/dss/dss_pack.c @@ -328,17 +328,18 @@ int opal_dss_pack_string(opal_buffer_t *buffer, const void *src, int opal_dss_pack_float(opal_buffer_t *buffer, const void *src, int32_t num_vals, opal_data_type_t type) { - int64_t tmp[2]; int ret = OPAL_SUCCESS; int32_t i; float *ssrc = (float*)src; + char *convert; for (i = 0; i < num_vals; ++i) { - tmp[0] = (int64_t)ssrc[i]; - tmp[1] = (int64_t)(1000000.0 * (ssrc[i] - tmp[0])); - if (OPAL_SUCCESS != (ret = opal_dss_pack_int64(buffer, tmp, 2, OPAL_INT64))) { + asprintf(&convert, "%f", ssrc[i]); + if (OPAL_SUCCESS != (ret = opal_dss_pack_string(buffer, &convert, 1, OPAL_STRING))) { + free(convert); return ret; } + free(convert); } return OPAL_SUCCESS; diff --git a/opal/dss/dss_unpack.c b/opal/dss/dss_unpack.c index b8f403822f..3f3c4a1d34 100644 --- a/opal/dss/dss_unpack.c +++ b/opal/dss/dss_unpack.c @@ -402,9 +402,9 @@ int opal_dss_unpack_float(opal_buffer_t *buffer, void *dest, int32_t *num_vals, opal_data_type_t type) { int32_t i, n; - int64_t tmp[2]; float *desttmp = (float*) dest; int ret; + char *convert; OPAL_OUTPUT( ( opal_dss_verbose, "opal_dss_unpack_float * %d\n", (int)*num_vals ) ); /* check to see if there's enough data in buffer */ @@ -414,11 +414,12 @@ int opal_dss_unpack_float(opal_buffer_t *buffer, void *dest, /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { - n=2; - if (OPAL_SUCCESS != (ret = opal_dss_unpack_int64(buffer, tmp, &n, OPAL_INT64))) { + n=1; + if (OPAL_SUCCESS != (ret = opal_dss_unpack_string(buffer, &convert, &n, OPAL_STRING))) { return ret; } - desttmp[i] = (float)tmp[0] + (float)tmp[1]/1000000.0; + desttmp[i] = strtof(convert, NULL); + free(convert); } return OPAL_SUCCESS; }