aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/unix/sys.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-02-10 17:07:01 +0100
committerSverker Eriksson <[email protected]>2014-02-19 17:20:05 +0100
commitf8693cf61f0555fb0108956f2d21d2234e01251d (patch)
tree8259d739a28dbecb6c7088a2bf8351b0e01da166 /erts/emulator/sys/unix/sys.c
parent32d4c07508eeffac64fd901431366d2c34416684 (diff)
downloadotp-f8693cf61f0555fb0108956f2d21d2234e01251d.tar.gz
otp-f8693cf61f0555fb0108956f2d21d2234e01251d.tar.bz2
otp-f8693cf61f0555fb0108956f2d21d2234e01251d.zip
erts: Fix faulty asserts in erts_sys_aligned_alloc/free
Diffstat (limited to 'erts/emulator/sys/unix/sys.c')
-rw-r--r--erts/emulator/sys/unix/sys.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index a5294ad84e..865cb50a56 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2014. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -2561,7 +2561,7 @@ void *erts_sys_aligned_alloc(UWord alignment, UWord size)
#ifdef HAVE_POSIX_MEMALIGN
void *ptr = NULL;
int error;
- ASSERT(alignment && (alignment & ~alignment) == 0); /* power of 2 */
+ ASSERT(alignment && (alignment & (alignment-1)) == 0); /* power of 2 */
error = posix_memalign(&ptr, (size_t) alignment, (size_t) size);
#if HAVE_ERTS_MSEG
if (error || !ptr) {
@@ -2584,7 +2584,7 @@ void *erts_sys_aligned_alloc(UWord alignment, UWord size)
void erts_sys_aligned_free(UWord alignment, void *ptr)
{
- ASSERT(alignment && (alignment & ~alignment) == 0); /* power of 2 */
+ ASSERT(alignment && (alignment & (alignment-1)) == 0); /* power of 2 */
free(ptr);
}