Bug 792581 - part 14 - Replace LL_SHL, LL_SHR, LL_USHR macros with bitwise operators. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Fri, 12 Oct 2012 13:29:10 -0400
changeset 110249 7a7fbacd886cc7fe9bd240d3ea0c7309b2ef2722
parent 110248 76071e66c36bfda0b6940a2f448f378295f4fae8
child 110250 6857ec16567d206eba481cd8e907da16f9a23c7d
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersehsan
bugs792581
milestone19.0a1
Bug 792581 - part 14 - Replace LL_SHL, LL_SHR, LL_USHR macros with bitwise operators. r=ehsan
netwerk/cache/nsCacheService.cpp
rdf/base/src/nsRDFService.cpp
xpcom/io/nsLocalFileOS2.cpp
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -941,18 +941,17 @@ nsCacheProfilePrefObserver::MemoryCacheC
         bytes = 32 * 1024 * 1024;
 
     // Conversion from unsigned int64 to double doesn't work on all platforms.
     // We need to truncate the value at INT64_MAX to make sure we don't
     // overflow.
     if (bytes > INT64_MAX)
         bytes = INT64_MAX;
 
-    uint64_t kbytes;
-    LL_SHR(kbytes, bytes, 10);
+    uint64_t kbytes = bytes >> 10;
 
     double kBytesD;
     LL_L2D(kBytesD, (int64_t) kbytes);
 
     double x = log(kBytesD)/log(2.0) - 14;
     if (x > 0) {
         capacity = (int32_t)(x * x / 3.0 + x + 2.0 / 3 + 0.1); // 0.1 for rounding
         if (capacity > 32)
--- a/rdf/base/src/nsRDFService.cpp
+++ b/rdf/base/src/nsRDFService.cpp
@@ -236,17 +236,17 @@ struct DateHashEntry : public PLDHashEnt
     PRTime      mKey;
 
     static PLDHashNumber
     HashKey(PLDHashTable *table, const void *key)
     {
         // xor the low 32 bits with the high 32 bits.
         PRTime t = *static_cast<const PRTime *>(key);
         int64_t h64, l64;
-        LL_USHR(h64, t, 32);
+        h64 = t >> 32;
         l64 = LL_INIT(0, 0xffffffff);
         l64 &= t;
         int32_t h32, l32;
         LL_L2I(h32, h64);
         LL_L2I(l32, l64);
         return PLDHashNumber(l32 ^ h32);
     }
 
--- a/xpcom/io/nsLocalFileOS2.cpp
+++ b/xpcom/io/nsLocalFileOS2.cpp
@@ -83,22 +83,22 @@ static nsresult ConvertOS2Error(int err)
 static void
 myLL_L2II(int64_t result, int32_t *hi, int32_t *lo )
 {
     int64_t a64, b64;  // probably could have been done with
                        // only one int64_t, but these are macros,
                        // and I am a wimp.
 
     // shift the hi word to the low word, then push it into a long.
-    LL_SHR(a64, result, 32);
+    a64 = result >> 32;
     LL_L2I(*hi, a64);
 
     // shift the low word to the hi word first, then shift it back.
-    LL_SHL(b64, result, 32);
-    LL_SHR(a64, b64, 32);
+    b64 = result << 32;
+    a64 = b64 >> 32;
     LL_L2I(*lo, a64);
 }
 
 // Locates the first occurrence of charToSearchFor in the stringToSearch
 static unsigned char*
 _mbschr(const unsigned char* stringToSearch, int charToSearchFor)
 {
     const unsigned char* p = stringToSearch;