aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-11-14 15:47:37 +0100
committerSverker Eriksson <[email protected]>2012-11-21 17:42:27 +0100
commitc519fd567d661d7d75a678455b2e9651ba3b421d (patch)
tree033d8ba00fef9c534a44579a51b3e4e4e540d942 /erts/emulator
parent87004cf5c70a528bb34fee9c629257c494a3f61a (diff)
downloadotp-c519fd567d661d7d75a678455b2e9651ba3b421d.tar.gz
otp-c519fd567d661d7d75a678455b2e9651ba3b421d.tar.bz2
otp-c519fd567d661d7d75a678455b2e9651ba3b421d.zip
erts: Don't let zero be considered a power of two
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/sys/common/erl_mseg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c
index 5fff8e5ed7..84830d91ec 100644
--- a/erts/emulator/sys/common/erl_mseg.c
+++ b/erts/emulator/sys/common/erl_mseg.c
@@ -68,7 +68,7 @@
#define ALIGNED_CEILING(X) ALIGNED_FLOOR((X) + INV_ALIGNED_MASK)
#define MAP_IS_ALIGNED(X) (((UWord)(X) & (MSEG_ALIGNED_SIZE - 1)) == 0)
-#define IS_2POW(X) (((X) & ((X) - 1)) == 0)
+#define IS_2POW(X) ((X) && !((X) & ((X) - 1)))
static ERTS_INLINE Uint ceil_2pow(Uint x) {
int i = 1 << (4 + (sizeof(Uint) != 4 ? 1 : 0));
x--;