Bug 691143: Avoid negation of unsigned. (r=luke)
authorChris Leary <cdleary@mozilla.com>
Mon, 03 Oct 2011 10:28:50 -0700
changeset 78001 d7dec44f259a79ab97a03124c52ac6ae0690c7f5
parent 78000 131fcce099afd14fb30eba9f8ec45b799c241087
child 78002 092140ecc44cfe425fc644fdbed1d476fcaeffcf
push id21260
push usermbrubeck@mozilla.com
push dateMon, 03 Oct 2011 23:22:50 +0000
treeherdermozilla-central@25b8388347af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs691143
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 691143: Avoid negation of unsigned. (r=luke)
js/src/ds/LifoAlloc.h
--- a/js/src/ds/LifoAlloc.h
+++ b/js/src/ds/LifoAlloc.h
@@ -60,17 +60,17 @@ static const size_t LIFO_ALLOC_ALIGN = 8
 JS_ALWAYS_INLINE
 char *
 AlignPtr(void *orig)
 {
     typedef tl::StaticAssert<
         tl::FloorLog2<LIFO_ALLOC_ALIGN>::result == tl::CeilingLog2<LIFO_ALLOC_ALIGN>::result
     >::result _;
 
-    char *result = (char *) ((uintptr_t(orig) + (LIFO_ALLOC_ALIGN - 1)) & -LIFO_ALLOC_ALIGN);
+    char *result = (char *) ((uintptr_t(orig) + (LIFO_ALLOC_ALIGN - 1)) & (~LIFO_ALLOC_ALIGN + 1));
     JS_ASSERT(uintptr_t(result) % LIFO_ALLOC_ALIGN == 0);
     return result;
 }
 
 /* Header for a chunk of memory wrangled by the LifoAlloc. */
 class BumpChunk
 {
     char        *bump;