summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5TB.c48
-rw-r--r--src/H5TBprivate.h1
2 files changed, 49 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 */
diff --git a/src/H5TBprivate.h b/src/H5TBprivate.h
index 665f3eb..25d46ea 100644
--- a/src/H5TBprivate.h
+++ b/src/H5TBprivate.h
@@ -100,6 +100,7 @@ typedef struct H5TB_tree
#define H5TB_FAST_HADDR_COMPARE 1
#define H5TB_FAST_INTN_COMPARE 2
#define H5TB_FAST_STR_COMPARE 3
+#define H5TB_FAST_HSIZE_COMPARE 4
/* Define an access macro for getting a node's data */
#define H5TB_NODE_DATA(n) ((n)->data)