summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-03-11 22:04:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-03-11 22:04:30 (GMT)
commit2501750f5e1ef612f8ab3d7112c0f29381be6466 (patch)
tree5dd25d1c2c318ee97e9806cc10df4027347a1c49 /src/H5private.h
parent6af9839f16b6dd96e1e961f527cbbce31f05b33f (diff)
downloadhdf5-2501750f5e1ef612f8ab3d7112c0f29381be6466.zip
hdf5-2501750f5e1ef612f8ab3d7112c0f29381be6466.tar.gz
hdf5-2501750f5e1ef612f8ab3d7112c0f29381be6466.tar.bz2
[svn-r12081] Purpose:
New feature Description: Update "power of two" macro and add "general" log2() routine. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/H5private.h b/src/H5private.h
index 531b3dd..5d1494f 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -326,7 +326,8 @@
#endif
/* test for number that is a power of 2 */
-# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 0)
+/* (from: http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2) */
+# define POWER_OF_TWO(n) (!(n & (n - 1)) && n)
/*
* HDF Boolean type.