summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2000-05-09 20:40:44 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2000-05-09 20:40:44 (GMT)
commit330d49b27aace66a65b8b3ec9fdd3a25573c09bb (patch)
tree44ed9e92659a1b5730895d01ddfb5f839c3cbea8
parent6f5d6505a1f919620267236672c5c9056dd69313 (diff)
downloadhdf5-330d49b27aace66a65b8b3ec9fdd3a25573c09bb.zip
hdf5-330d49b27aace66a65b8b3ec9fdd3a25573c09bb.tar.gz
hdf5-330d49b27aace66a65b8b3ec9fdd3a25573c09bb.tar.bz2
[svn-r2235] Changed POWER_OF_TWO macro to allow 1 as a valid power of two. Changed
the has_size check accordingly (1 wasn't allowed in the original code).
-rw-r--r--src/H5I.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/H5I.c b/src/H5I.c
index e8cebb6..94470aa 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -88,7 +88,7 @@ static herr_t H5I_init_interface(void);
* than the ID_MASK constant).
*/
# define H5I_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1)))
-# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 1)
+# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 0)
#else
/*
* Map an ID to a hash location.
@@ -225,6 +225,10 @@ H5I_term_interface(void)
* two, I placed it in a macro POWER_OF_TWO which uses the fact
* that a number that is a power of two has only 1 bit set.
*
+ * Bill Wendling, 2000-05-09
+ * Changed POWER_OF_TWO macro to allow 1 as a valid power of two.
+ * Changed test below accordingly.
+ *
*-------------------------------------------------------------------------
*/
intn
@@ -241,7 +245,7 @@ H5I_init_group(H5I_type_t grp, size_t hash_size, uintn reserved,
HGOTO_DONE(FAIL);
}
#ifdef HASH_SIZE_POWER_2
- if (!POWER_OF_TWO(hash_size))
+ if (!POWER_OF_TWO(hash_size) || hash_size == 1)
HGOTO_DONE(FAIL);
#endif /* HASH_SIZE_POWER_2 */