Bug 1318677 part 1 - Use a smaller mask to remove the error tag. r=jandem
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 07 Feb 2017 18:57:42 +0000
changeset 387922 2d01a306f0f424783e36b79cbb83662243569af8
parent 387921 959e338a566a64a8c268f72d7f1ada2d2b184468
child 387923 9d73f44230343ca5a667f24e6d8b949635c46cd3
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1318677
milestone54.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 1318677 part 1 - Use a smaller mask to remove the error tag. r=jandem
mfbt/Result.h
--- a/mfbt/Result.h
+++ b/mfbt/Result.h
@@ -109,17 +109,17 @@ public:
   {
     MOZ_ASSERT((uintptr_t(&aErrorValue) % MOZ_ALIGNOF(E)) == 0,
                "Result errors must not be misaligned");
   }
 
   bool isOk() const { return (mBits & 1) == 0; }
 
   V* unwrap() const { return reinterpret_cast<V*>(mBits); }
-  E& unwrapErr() const { return *reinterpret_cast<E*>(mBits & ~uintptr_t(1)); }
+  E& unwrapErr() const { return *reinterpret_cast<E*>(mBits ^ 1); }
 };
 
 // A bit of help figuring out which of the above specializations to use.
 //
 // We begin by safely assuming types don't have a spare bit.
 template <typename T> struct HasFreeLSB { static const bool value = false; };
 
 // The lowest bit of a properly-aligned pointer is always zero if the pointee