summaryrefslogtreecommitdiffstats
path: root/src/H5HFdtable.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-04-30 13:32:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-04-30 13:32:41 (GMT)
commit4965bf1839b4219c3063e27d37bc59a777cc1fb5 (patch)
tree925c87307aa9c13c66c301b0d3ca9283e9b20d32 /src/H5HFdtable.c
parenteb96132022da938d4b54ae4dd482919a178c4ee5 (diff)
downloadhdf5-4965bf1839b4219c3063e27d37bc59a777cc1fb5.zip
hdf5-4965bf1839b4219c3063e27d37bc59a777cc1fb5.tar.gz
hdf5-4965bf1839b4219c3063e27d37bc59a777cc1fb5.tar.bz2
[svn-r12317] Purpose:
Code checkpoint Description: More progress on fractal heap, can now re-open an existing heap, although the free space algorithm still needs work. Also, use the new "pinned entry" metadata cache code. Platforms tested: FreeBSD 4.11 (sleipnir) Linux 2.4 (heping) Solaris 9 (shanti) Linux 2.4/64 (mir)
Diffstat (limited to 'src/H5HFdtable.c')
-rw-r--r--src/H5HFdtable.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c
index e571b85..e51b45b 100644
--- a/src/H5HFdtable.c
+++ b/src/H5HFdtable.c
@@ -211,3 +211,37 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_dtable_dest() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5HF_dtable_size_to_row
+ *
+ * Purpose: Compute row that can hold block of a certain size
+ *
+ * Return: Non-negative on success (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Apr 25 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5HF_dtable_size_to_row(H5HF_dtable_t *dtable, size_t block_size)
+{
+ unsigned row; /* Row where block will fit */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_dtable_size_to_row)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(dtable);
+
+ if(block_size == dtable->cparam.start_block_size)
+ row = 0;
+ else
+ row = (H5V_log2_of2((uint32_t)block_size) - H5V_log2_of2(dtable->cparam.start_block_size)) + 1;
+
+ FUNC_LEAVE_NOAPI(row)
+} /* end H5HF_dtable_size_to_row() */
+