herr_t H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t UNUSED bkg_stride, void *buf, void UNUSED *bkg, hid_t dxpl_id) { void *tmp_buf; /* Traversal-related variables */ H5T_t *src_p; /*source datatype */ H5T_t *dst_p; /*destination datatype */ H5T_atomic_t src; /*atomic source info */ H5T_atomic_t dst; /*atomic destination info */ int direction; /*forward or backward traversal */ size_t elmtno; /*element number */ size_t half_size; /*half the type size */ size_t tsize; /*type size for swapping bytes */ size_t olap; /*num overlapping elements */ uint8_t *fix_s, *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ uint8_t dbuf[64]; /*temp destination buffer */ uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/ /* Conversion-related variables */ hsize_t expo; /*destination exponent */ hsize_t expo_max; /*maximal possible exponent value */ size_t sign; /*source sign bit value */ hbool_t is_max_neg; /*source is maximal negative value*/ hbool_t do_round; /*whether there is roundup */ size_t i; /*miscellaneous counters */ size_t first; /*first bit(MSB) in an integer */ ssize_t sfirst; /*a signed version of `first' */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE switch(cdata->command) { case H5T_CONV_INIT: if(NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if(H5T_ORDER_LE != dst.order && H5T_ORDER_BE != dst.order && H5T_ORDER_VAX != dst.order) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") if(dst_p->shared->size > sizeof(dbuf)) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") if(8 * sizeof(expo) - 1 < src.u.f.esize) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") cdata->need_bkg = H5T_BKG_NO; break; case H5T_CONV_FREE: break; case H5T_CONV_CONV: /* Get the datatypes */ if(NULL == (src_p = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || NULL == (dst_p = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; tmp_buf = (void *)H5MM_malloc(nelmts * 4); HDmemcpy(tmp_buf, buf, nelmts * 4); fix_s = tmp_buf; /* Do we process the values from beginning to end or vice versa? */ { olap = (size_t)1; sp = (uint8_t*)tmp_buf + (nelmts-1) * src_p->shared->size; dp = (uint8_t*)tmp_buf + (nelmts-1) * dst_p->shared->size; direction = -1; } /* The conversion loop */ for (elmtno=0; elmtno= nelmts) ? dbuf : dp; } padding: if(direction < 0 && elmtnoshared->size; dp += direction * dst_p->shared->size; } } HDmemcpy(buf, tmp_buf, nelmts * 4); H5MM_xfree(tmp_buf); break; default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__conv_i_f() */