summaryrefslogtreecommitdiffstats
path: root/src/H5Tprecis.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-18 16:10:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-18 16:10:46 (GMT)
commitb0eb42058c02bff41cacae11880b4fbf174821db (patch)
treec389ee389c680cccbd2a5c5f11107b588f4bcfa0 /src/H5Tprecis.c
parentdcf8866b6af90aa0bf50ebeceda6b0f184a07c17 (diff)
downloadhdf5-b0eb42058c02bff41cacae11880b4fbf174821db.zip
hdf5-b0eb42058c02bff41cacae11880b4fbf174821db.tar.gz
hdf5-b0eb42058c02bff41cacae11880b4fbf174821db.tar.bz2
[svn-r14208] Description:
Make H5Pget_filter_by_id() API versioned and switch internal usage to H5Pget_filter_by_id2(). Add simple regression test for H5Pget_filter_by_id1(). Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'src/H5Tprecis.c')
-rw-r--r--src/H5Tprecis.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index 4e55862..62493e9 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -80,7 +80,7 @@ H5T_init_precis_interface(void)
size_t
H5Tget_precision(hid_t type_id)
{
- H5T_t *dt = NULL;
+ H5T_t *dt;
size_t ret_value;
FUNC_ENTER_API(H5Tget_precision, 0)
@@ -89,17 +89,52 @@ H5Tget_precision(hid_t type_id)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype")
- while (dt->shared->parent)
- dt = dt->shared->parent; /*defer to parent*/
- if (!H5T_IS_ATOMIC(dt->shared))
+
+ /* Get precision */
+ if((ret_value = H5T_get_precision(dt)) == 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "cant't get precision for specified datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Tget_precision() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_get_precision
+ *
+ * Purpose: Gets the precision of a datatype. The precision is
+ * the number of significant bits which, unless padding is
+ * present, is 8 times larger than the value returned by
+ * H5Tget_size().
+ *
+ * Return: Success: Number of significant bits
+ * Failure: 0 (all atomic types have at least one
+ * significant bit)
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, October 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5T_get_precision(const H5T_t *dt)
+{
+ size_t ret_value;
+
+ FUNC_ENTER_NOAPI(H5T_get_precision, 0)
+
+ /* Defer to parent*/
+ while(dt->shared->parent)
+ dt = dt->shared->parent;
+ if(!H5T_IS_ATOMIC(dt->shared))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype")
/* Precision */
ret_value = dt->shared->u.atomic.prec;
done:
- FUNC_LEAVE_API(ret_value)
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_get_precision() */
/*-------------------------------------------------------------------------