summaryrefslogtreecommitdiffstats
path: root/src/H5TB.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-05-17 21:40:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-05-17 21:40:47 (GMT)
commitdddf167923a28c9cf65b05da565e1b7197b0cd37 (patch)
tree22baff78511c4926a372d57f4526d497d53a3057 /src/H5TB.c
parent9aba174ba53c80e150ea5d3a40d46bfd14185554 (diff)
downloadhdf5-dddf167923a28c9cf65b05da565e1b7197b0cd37.zip
hdf5-dddf167923a28c9cf65b05da565e1b7197b0cd37.tar.gz
hdf5-dddf167923a28c9cf65b05da565e1b7197b0cd37.tar.bz2
[svn-r6890] Purpose:
New feature Description: Added "fast comparison" code for hsize_t's, since they are used in th raw data chunking I/O code now. Platforms tested: h5committested
Diffstat (limited to 'src/H5TB.c')
-rw-r--r--src/H5TB.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/H5TB.c b/src/H5TB.c
index 1a057f2..be5952f 100644
--- a/src/H5TB.c
+++ b/src/H5TB.c
@@ -192,6 +192,32 @@ H5TB_int_cmp(const void *k1, const void *k2, int UNUSED cmparg)
/*-------------------------------------------------------------------------
+ * Function: H5TB_hsize_cmp
+ *
+ * Purpose: Key comparison routine for TBBT routines
+ *
+ * Return: same as comparing two hsize_t's
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 20, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5TB_hsize_cmp(const void *k1, const void *k2, int UNUSED cmparg)
+{
+ FUNC_ENTER_NOINIT(H5TB_hsize_cmp);
+
+ assert(k1);
+ assert(k2);
+
+ FUNC_LEAVE_NOAPI(*(const hsize_t *)k1 - *(const hsize_t *)k2);
+} /* end H5TB_hsize_cmp() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5TB_fast_dmake
*
* Purpose: Wrapper around H5TB_dmake for callers which want to use
@@ -233,6 +259,11 @@ H5TB_fast_dmake(unsigned fast_compare)
cmparg=-1;
break;
+ case H5TB_FAST_HSIZE_COMPARE:
+ compar=H5TB_hsize_cmp;
+ cmparg=-1;
+ break;
+
default:
HGOTO_ERROR (H5E_TBBT, H5E_BADVALUE, NULL, "invalid fast comparison type");
} /* end switch */
@@ -1459,6 +1490,23 @@ H5TB_ffind(H5TB_NODE * root, const void * key, unsigned fast_compare, H5TB_NODE
ret_value= (0 == cmp) ? ptr : NULL;
break;
+ case H5TB_FAST_HSIZE_COMPARE:
+ if (ptr) {
+ while (0 != (cmp = (int)(*(const hsize_t *)key - *(hsize_t *)ptr->key))) {
+ parent = ptr;
+ side = (cmp < 0) ? LEFT : RIGHT;
+ if (!HasChild(ptr, side))
+ break;
+ ptr = ptr->link[side];
+ } /* end while */
+ } /* end if */
+ if (NULL != pp)
+ *pp = parent;
+
+ /* Set return value */
+ ret_value= (0 == cmp) ? ptr : NULL;
+ break;
+
default:
break;
} /* end switch */