summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-10-28 04:26:33 (GMT)
committerJason Evans <jasone@canonware.com>2016-10-28 04:26:33 (GMT)
commit48d4adfbeb32fcc7f455547d89641cd1fc459361 (patch)
tree2ce432ebfd96deefe074ae55a1cccc4d7da9d56e /include
parentd76cfec319760c71bf3d30b9960c9e666785c461 (diff)
downloadjemalloc-48d4adfbeb32fcc7f455547d89641cd1fc459361.zip
jemalloc-48d4adfbeb32fcc7f455547d89641cd1fc459361.tar.gz
jemalloc-48d4adfbeb32fcc7f455547d89641cd1fc459361.tar.bz2
Avoid negation of unsigned numbers.
Rather than relying on two's complement negation for alignment mask generation, use bitwise not and addition. This dodges warnings from MSVC, and should be strength-reduced by compiler optimization anyway.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/jemalloc_internal.h.in4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
index fac0ea3..0e4ffd9 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -315,7 +315,7 @@ typedef unsigned szind_t;
/* Return the nearest aligned address at or below a. */
#define ALIGNMENT_ADDR2BASE(a, alignment) \
- ((void *)((uintptr_t)(a) & (-(alignment))))
+ ((void *)((uintptr_t)(a) & ((~(alignment)) + 1)))
/* Return the offset between a and the nearest aligned address at or below a. */
#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
@@ -323,7 +323,7 @@ typedef unsigned szind_t;
/* Return the smallest alignment multiple that is >= s. */
#define ALIGNMENT_CEILING(s, alignment) \
- (((s) + (alignment - 1)) & (-(alignment)))
+ (((s) + (alignment - 1)) & ((~(alignment)) + 1))
/* Declare a variable-length array. */
#if __STDC_VERSION__ < 199901L