Bug 735704 - RotateLeft32 conflicts with winnt.h macro r=Waldo
authorJacek Caban <jacek@codeweavers.com>
Thu, 15 Mar 2012 13:43:28 +0100
changeset 89438 61447dccb529ab286190cf44980946978b81b3d8
parent 89437 2205ed382ab08ed3d4863fb60f317f6a7c5f6d84
child 89439 d8cafe95ef83333b48c0f81d3965be23eec75970
push id7158
push userjacek@codeweavers.com
push dateThu, 15 Mar 2012 12:44:58 +0000
treeherdermozilla-inbound@d8cafe95ef83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs735704
milestone14.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 735704 - RotateLeft32 conflicts with winnt.h macro r=Waldo
mfbt/HashFunctions.h
--- a/mfbt/HashFunctions.h
+++ b/mfbt/HashFunctions.h
@@ -53,17 +53,17 @@
 namespace mozilla {
 
 /**
  * The golden ratio as a 32-bit fixed-point value.
  */
 static const uint32_t GoldenRatioU32 = 0x9E3779B9U;
 
 inline uint32_t
-RotateLeft32(uint32_t value, uint8_t bits)
+RotateBitsLeft32(uint32_t value, uint8_t bits)
 {
   MOZ_ASSERT(bits < 32);
   return (value << bits) | (value >> (32 - bits));
 }
 
 namespace detail {
 
 inline uint32_t
@@ -85,17 +85,17 @@ AddU32ToHash(uint32_t hash, uint32_t val
    *
    * The rotation length of 5 is also arbitrary, although an odd number is again
    * preferable so our hash explores the whole universe of possible rotations.
    *
    * Finally, we multiply by the golden ratio *after* xor'ing, not before.
    * Otherwise, if |hash| is 0 (as it often is for the beginning of a message),
    * the expression
    *
-   *   (GoldenRatioU32 * RotateLeft(hash, 5)) |xor| value
+   *   (GoldenRatioU32 * RotateBitsLeft(hash, 5)) |xor| value
    *
    * evaluates to |value|.
    *
    * (Number-theoretic aside: Because any odd number |m| is relatively prime to
    * our modulus (2^32), the list
    *
    *    [x * m (mod 2^32) for 0 <= x < 2^32]
    *
@@ -103,17 +103,17 @@ AddU32ToHash(uint32_t hash, uint32_t val
    * cause us to skip any possible hash values.
    *
    * It's also nice if |m| has large-ish order mod 2^32 -- that is, if the
    * smallest k such that m^k == 1 (mod 2^32) is large -- so we can safely
    * multiply our hash value by |m| a few times without negating the
    * multiplicative effect.  Our golden ratio constant has order 2^29, which is
    * more than enough for our purposes.)
    */
-  return GoldenRatioU32 * (RotateLeft32(hash, 5) ^ value);
+  return GoldenRatioU32 * (RotateBitsLeft32(hash, 5) ^ value);
 }
 
 /**
  * AddUintptrToHash takes sizeof(uintptr_t) as a template parameter.
  */
 template<size_t PtrSize>
 inline uint32_t
 AddUintptrToHash(uint32_t hash, uintptr_t value);