diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2005-06-14 20:37:04 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2005-06-14 20:37:04 (GMT) |
commit | 162b19cd6c1f6c6b14254c60b83bd14b1c11184c (patch) | |
tree | 2185b176ed9612511bb749fd1db4de2779278724 | |
parent | 3344dd72ed167f95add9ed58da70e03ca336c2a4 (diff) | |
download | hdf5-162b19cd6c1f6c6b14254c60b83bd14b1c11184c.zip hdf5-162b19cd6c1f6c6b14254c60b83bd14b1c11184c.tar.gz hdf5-162b19cd6c1f6c6b14254c60b83bd14b1c11184c.tar.bz2 |
[svn-r10919] Purpose: Take Out An Unused Function
Description: Data conversion function H5T_conv_i32le_f64le() was unused.
Because we have new conversion functions for integers and floating numbers,
this old function is taken out.
Platforms tested: fuss - simple change.
Misc. update:
-rw-r--r-- | src/H5FD.c | 1 | ||||
-rw-r--r-- | src/H5T.c | 4 | ||||
-rw-r--r-- | src/H5Tconv.c | 391 | ||||
-rw-r--r-- | src/H5Tpkg.h | 6 |
4 files changed, 1 insertions, 401 deletions
@@ -2937,6 +2937,7 @@ H5FDset_eoa(H5FD_t *file, haddr_t addr) /* Check args */ if (!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + if (!H5F_addr_defined(addr) || addr>file->maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") @@ -980,10 +980,6 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T_conv_array, H5AC_dxpl_id); status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T_conv_order_opt, H5AC_dxpl_id); - /* Custom conversion for 32-bit ints to 64-bit floats (undocumented) */ - status |= H5T_register(H5T_PERS_HARD, "u32le_f64le", std_u32le, ieee_f64le, H5T_conv_i32le_f64le, H5AC_dxpl_id); - status |= H5T_register(H5T_PERS_HARD, "i32le_f64le", std_i32le, ieee_f64le, H5T_conv_i32le_f64le, H5AC_dxpl_id); - /* * Native conversions should be listed last since we can use hardware to * perform the conversion. We list the odd types like `llong', `long', diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 8dabcc8..0386b8c 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -9155,397 +9155,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5T_conv_i32le_f64le - * - * Purpose: Converts 4-byte little-endian integers (signed or unsigned) - * to 8-byte litte-endian IEEE floating point. - * - * Return: Non-negative on success/Negative on failure - * - * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 - * - * Modifications: - * Robb Matzke, 1999-06-16 - * Added support for non-zero strides. If BUF_STRIDE is non-zero - * then convert one value at each memory location advancing - * BUF_STRIDE bytes each time; otherwise assume both source and - * destination values are packed. - *------------------------------------------------------------------------- - */ -herr_t -H5T_conv_i32le_f64le (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 UNUSED dxpl_id) -{ - uint8_t *s=NULL, *d=NULL; /*src and dst buf pointers */ - uint8_t tmp[8]; /*temporary destination buffer */ - H5T_t *src = NULL; /*source data type */ - size_t elmtno; /*element counter */ - unsigned sign; /*sign bit */ - unsigned cin, cout; /*carry in/out */ - unsigned mbits=0; /*mantissa bits */ - unsigned exponent; /*exponent */ - int i; /*counter */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5T_conv_i32le_f64le, FAIL); - - switch (cdata->command) { - case H5T_CONV_INIT: - assert (sizeof(int)>=4); - cdata->need_bkg = H5T_BKG_NO; - break; - - case H5T_CONV_FREE: - /* Free private data */ - break; - - case H5T_CONV_CONV: - /* The conversion */ - if (NULL==(src=H5I_object(src_id)) || - NULL==H5I_object(dst_id)) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); - - s = (uint8_t*)buf + (buf_stride?buf_stride:4)*(nelmts-1); - d = (uint8_t*)buf + (buf_stride?buf_stride:8)*(nelmts-1); - for (elmtno=0; elmtno<nelmts; elmtno++) { - - /* - * If this is the last element to convert (that is, the first - * element of the buffer) then the source and destination areas - * overlap so we need to use a temp buf for the destination. - */ - if ((void*)s==buf) - d = tmp; - - /* Convert the integer to a sign and magnitude */ - switch (src->shared->u.atomic.u.i.sign) { - case H5T_SGN_NONE: - sign = 0; - break; - - case H5T_SGN_2: - if (s[3] & 0x80) { - sign = 1; - for (i=0,cin=1; i<4; i++,cin=cout) { - s[i] = ~s[i]; - cout = ((unsigned)(s[i])+cin > 0xff) ? 1 : 0; - s[i] += cin; - } - } else { - sign = 0; - } - break; - - default: - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported integer sign method"); - } - - /* - * Where is the most significant bit that is set? We could do - * this in a loop, but testing it this way might be faster. - */ - if (s[3]) { - if (s[3] & 0x80) mbits = 32; - else if (s[3] & 0x40) mbits = 31; - else if (s[3] & 0x20) mbits = 30; - else if (s[3] & 0x10) mbits = 29; - else if (s[3] & 0x08) mbits = 28; - else if (s[3] & 0x04) mbits = 27; - else if (s[3] & 0x02) mbits = 26; - else if (s[3] & 0x01) mbits = 25; - } else if (s[2]) { - if (s[2] & 0x80) mbits = 24; - else if (s[2] & 0x40) mbits = 23; - else if (s[2] & 0x20) mbits = 22; - else if (s[2] & 0x10) mbits = 21; - else if (s[2] & 0x08) mbits = 20; - else if (s[2] & 0x04) mbits = 19; - else if (s[2] & 0x02) mbits = 18; - else if (s[2] & 0x01) mbits = 17; - } else if (s[1]) { - if (s[1] & 0x80) mbits = 16; - else if (s[1] & 0x40) mbits = 15; - else if (s[1] & 0x20) mbits = 14; - else if (s[1] & 0x10) mbits = 13; - else if (s[1] & 0x08) mbits = 12; - else if (s[1] & 0x04) mbits = 11; - else if (s[1] & 0x02) mbits = 10; - else if (s[1] & 0x01) mbits = 9; - } else if (s[0]) { - if (s[0] & 0x80) mbits = 8; - else if (s[0] & 0x40) mbits = 7; - else if (s[0] & 0x20) mbits = 6; - else if (s[0] & 0x10) mbits = 5; - else if (s[0] & 0x08) mbits = 4; - else if (s[0] & 0x04) mbits = 3; - else if (s[0] & 0x02) mbits = 2; - else if (s[0] & 0x01) mbits = 1; - } else { - /*zero*/ - d[7] = d[6] = d[5] = d[4] = d[3] = d[2] = d[1] = d[0] = 0; - continue; - } - - /* - * The sign and exponent. - */ - exponent = (mbits - 1) + 1023; - d[7] = (sign<<7) | ((exponent>>4) & 0x7f); - d[6] = (exponent & 0x0f) << 4; - - /* - * The mantissa. - */ - switch (mbits) { - case 32: - d[5] = d[4] = d[3] = d[1] = d[0] = 0; - break; - - case 31: - d[6] |= 0x0f & (s[3]>>2); - d[5] = (s[3]<<6) | (s[2]>>2); - d[4] = (s[2]<<6) | (s[1]>>2); - d[3] = (s[1]<<6) | (s[0]>>2); - d[2] = (s[0]<<6); - d[1] = d[0] = 0; - break; - - case 30: - d[6] |= 0x0f & (s[3]>>1); - d[5] = (s[3]<<7) | (s[2]>>1); - d[4] = (s[2]<<7) | (s[1]>>1); - d[3] = (s[1]<<7) | (s[0]>>1); - d[2] = (s[0]<<7); - d[1] = d[0] = 0; - break; - - case 29: - d[6] |= 0x0f & s[3]; - d[5] = s[2]; - d[4] = s[1]; - d[3] = s[0]; - d[2] = d[1] = d[0] = 0; - break; - - case 28: - d[6] |= ((s[3]<<1) | (s[2]>>7)) & 0x0f; - d[5] = (s[2]<<1) | (s[1]>>7); - d[4] = (s[1]<<1) | (s[0]>>7); - d[3] = (s[0]<<1); - d[2] = d[1] = d[0] = 0; - break; - - case 27: - d[6] |= ((s[3]<<2) | (s[2]>>6)) & 0x0f; - d[5] = (s[2]<<2) | (s[1]>>6); - d[4] = (s[1]<<2) | (s[0]>>6); - d[3] = (s[0]<<2); - d[2] = d[1] = d[0] = 0; - break; - - case 26: - d[6] |= ((s[3]<<3) | (s[2]>>5)) & 0x0f; - d[5] = (s[2]<<3) | (s[1]>>5); - d[4] = (s[1]<<3) | (s[0]>>5); - d[3] = (s[0]<<3); - d[2] = d[1] = d[0] = 0; - break; - - case 25: - d[6] |= 0x0f & (s[2]>>4); - d[5] = (s[2]<<4) | (s[1]>>4); - d[4] = (s[1]<<4) | (s[0]>>4); - d[3] = (s[0]<<4); - d[2] = d[1] = d[0] = 0; - break; - - case 24: - d[6] |= 0x0f & (s[2]>>3); - d[5] = (s[2]<<5) | (s[1]>>3); - d[4] = (s[1]<<5) | (s[0]>>3); - d[3] = (s[0]<<5); - d[2] = d[1] = d[0] = 0; - break; - - case 23: - d[6] |= 0x0f & (s[2]>>2); - d[5] = (s[2]<<6) | (s[1]>>2); - d[4] = (s[1]<<6) | (s[0]>>2); - d[3] = (s[0]<<6); - d[2] = d[1] = d[0] = 0; - break; - - case 22: - d[6] |= 0x0f & (s[2]>>1); - d[5] = (s[2]<<7) | (s[1]>>1); - d[4] = (s[1]<<7) | (s[0]>>1); - d[3] = (s[0]<<7); - d[2] = d[1] = d[0] = 0; - break; - - case 21: - d[6] |= 0x0f & s[2]; - d[5] = s[1]; - d[4] = s[0]; - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 20: - d[6] |= ((s[2]<<1) | (s[1]>>7)) & 0x0f; - d[5] = (s[1]<<1) | (s[0]>>7); - d[4] = (s[0]<<1); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 19: - d[6] |= ((s[2]<<2) | (s[1]>>6)) & 0x0f; - d[5] = (s[1]<<2) | (s[0]>>6); - d[4] = (s[0]<<2); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 18: - d[6] |= ((s[2]<<3) | (s[1]>>5)) & 0x0f; - d[5] = (s[1]<<3) | (s[0]>>5); - d[4] = (s[0]<<3); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 17: - d[6] |= 0x0f & (s[1]>>4); - d[5] = (s[1]<<4) | (s[0]>>4); - d[4] = (s[0]<<4); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 16: - d[6] |= 0x0f & (s[1]>>3); - d[5] = (s[1]<<5) | (s[0]>>3); - d[4] = (s[0]<<5); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 15: - d[6] |= 0x0f & (s[1]>>2); - d[5] = (s[1]<<6) | (s[0]>>2); - d[4] = (s[0]<<6); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 14: - d[6] |= 0x0f & (s[1]>>1); - d[5] = (s[1]<<7) | (s[0]>>1); - d[4] = (s[0]<<7); - d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 13: - d[6] |= 0x0f & s[1]; - d[5] = s[0]; - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 12: - d[6] |= ((s[1]<<1) | (s[0]>>7)) & 0x0f; - d[5] = (s[0]<<1); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 11: - d[6] |= ((s[1]<<2) | (s[0]>>6)) & 0x0f; - d[5] = (s[0]<<2); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 10: - d[6] |= ((s[1]<<3) | (s[0]>>5)) & 0x0f; - d[5] = (s[0]<<3); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 9: - d[6] |= 0x0f & (s[0]>>4); - d[5] = (s[0]<<4); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 8: - d[6] |= 0x0f & (s[0]>>3); - d[5] = (s[0]<<5); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 7: - d[6] |= 0x0f & (s[0]>>2); - d[5] = (s[0]<<6); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 6: - d[6] |= 0x0f & (s[0]>>1); - d[5] = (s[0]<<7); - d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 5: - d[6] |= 0x0f & s[0]; - d[5] = d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 4: - d[6] |= (s[0]<<1) & 0x0f; - d[5] = d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 3: - d[6] |= (s[0]<<2) & 0x0f; - d[5] = d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 2: - d[6] |= (s[0]<<3) & 0x0f; - d[5] = d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - - case 1: - d[5] = d[4] = d[3] = d[2] = d[1] = d[0] = 0; - break; - } - - /* - * Copy temp buffer to the destination. This only happens for - * the first value in the array, the last value processed. See - * beginning of loop. - */ - if (d==tmp) - HDmemcpy (s, d, 8); - - /* Advance pointers */ - if (buf_stride) { - s -= buf_stride; - d -= buf_stride; - } else { - s -= 4; - d -= 8; - } - } - break; - - default: - /* Some other command we don't know about yet.*/ - HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); - } - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - - -/*------------------------------------------------------------------------- * Function: H5T_conv_f_i * * Purpose: Convert one floating-point type to an integer. This is diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index eb57d65..e562c66 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -1179,12 +1179,6 @@ H5_DLL herr_t H5T_conv_ldouble_ullong(hid_t src_id, hid_t dst_id, void *buf, void *bkg, hid_t dset_xfer_plist); -H5_DLL herr_t H5T_conv_i32le_f64le(hid_t src_id, hid_t dst_id, - H5T_cdata_t *cdata, size_t nelmts, - size_t buf_stride, size_t bkg_stride, - void *_buf, void *bkg, - hid_t dset_xfer_plist); - /* Bit twiddling functions */ H5_DLL void H5T_bit_copy(uint8_t *dst, size_t dst_offset, const uint8_t *src, size_t src_offset, size_t size); |