Bug 792581 - part 12: Replace LL_DIV with division operator. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Fri, 05 Oct 2012 01:05:28 -0400
changeset 109328 ee43ffdf7dde90ba1a84f2786ef5837c9a4669f2
parent 109327 05cd1044c8c7a3b710a7a61e74872dfb606fbe27
child 109329 01ada5d631e7e156f828069990be5f197148ae19
push id23619
push useremorley@mozilla.com
push dateFri, 05 Oct 2012 10:54:02 +0000
treeherdermozilla-central@3b458f4e0f42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs792581
milestone18.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 792581 - part 12: Replace LL_DIV with division operator. r=ehsan
docshell/base/nsDocShell.h
layout/generic/nsBlockFrame.cpp
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/cache/nsCache.cpp
netwerk/dns/nsHostResolver.cpp
security/manager/ssl/src/nsCRLManager.cpp
tools/trace-malloc/spacetrace.c
tools/trace-malloc/tmfrags.c
tools/trace-malloc/tmstats.c
uriloader/prefetch/nsPrefetchService.cpp
xpcom/io/nsLocalFileOS2.cpp
xpcom/io/nsLocalFileWin.cpp
xpcom/tests/CvtURL.cpp
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -530,17 +530,17 @@ protected:
     nsresult SetBaseUrlForWyciwyg(nsIContentViewer * aContentViewer);
 
     static  inline  uint32_t
     PRTimeToSeconds(PRTime t_usec)
     {
       PRTime usec_per_sec;
       uint32_t t_sec;
       LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
-      LL_DIV(t_usec, t_usec, usec_per_sec);
+      t_usec /= usec_per_sec;
       LL_L2I(t_sec, t_usec);
       return t_sec;
     }
 
     bool IsFrame();
 
     //
     // Helper method that is called when a new document (including any
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1233,17 +1233,17 @@ nsBlockFrame::Reflow(nsPresContext*     
     PRTime end = PR_Now();
 
     int32_t ectc = nsLineBox::GetCtorCount();
     int32_t numLines = mLines.size();
     if (!numLines) numLines = 1;
     PRTime delta, perLineDelta, lines;
     LL_I2L(lines, numLines);
     delta = end - start;
-    LL_DIV(perLineDelta, delta, lines);
+    perLineDelta = delta / lines;
 
     ListTag(stdout);
     char buf[400];
     PR_snprintf(buf, sizeof(buf),
                 ": %lld elapsed (%lld per line) (%d lines; %d new lines)",
                 delta, perLineDelta, numLines, ectc - ctc);
     printf("%s\n", buf);
   }
@@ -6204,17 +6204,17 @@ nsBlockFrame::BuildDisplayList(nsDisplay
   if (gLamePaintMetrics) {
     PRTime end = PR_Now();
 
     int32_t numLines = mLines.size();
     if (!numLines) numLines = 1;
     PRTime lines, deltaPerLine, delta;
     LL_I2L(lines, numLines);
     delta = end - start;
-    LL_DIV(deltaPerLine, delta, lines);
+    deltaPerLine = delta / lines;
 
     ListTag(stdout);
     char buf[400];
     PR_snprintf(buf, sizeof(buf),
                 ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d",
                 delta, deltaPerLine,
                 numLines, drawnLines, numLines - drawnLines);
     printf("%s\n", buf);
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -779,17 +779,17 @@ nsProtocolProxyService::SecondsSinceSess
     PRTime now = PR_Now();
 
     // get time elapsed since session start
     int64_t diff = now - mSessionStart;
 
     // convert microseconds to seconds
     PRTime ups;
     LL_I2L(ups, PR_USEC_PER_SEC);
-    LL_DIV(diff, diff, ups);
+    diff /= ups;
 
     // convert to 32 bit value
     uint32_t dsec;
     LL_L2UI(dsec, diff);
 
     return dsec;
 }
 
--- a/netwerk/cache/nsCache.cpp
+++ b/netwerk/cache/nsCache.cpp
@@ -44,17 +44,17 @@ CacheLogPrintPath(PRLogModuleLevel level
 
 uint32_t
 SecondsFromPRTime(PRTime prTime)
 {
   int64_t  microSecondsPerSecond, intermediateResult;
   uint32_t seconds;
 
   LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
-  LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
+  intermediateResult = prTime / microSecondsPerSecond;
   LL_L2UI(seconds, intermediateResult);
   return seconds;
 }
 
 
 PRTime
 PRTimeFromSeconds(uint32_t seconds)
 {
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -85,17 +85,17 @@ MoveCList(PRCList &from, PRCList &to)
     }             
 }
 
 static uint32_t
 NowInMinutes()
 {
     PRTime now = PR_Now(), minutes, factor;
     LL_I2L(factor, 60 * PR_USEC_PER_SEC);
-    LL_DIV(minutes, now, factor);
+    minutes = now / factor;
     uint32_t result;
     LL_L2UI(result, minutes);
     return result;
 }
 
 //----------------------------------------------------------------------------
 
 #if defined(RES_RETRY_ON_FAILURE)
--- a/security/manager/ssl/src/nsCRLManager.cpp
+++ b/security/manager/ssl/src/nsCRLManager.cpp
@@ -411,17 +411,17 @@ nsCRLManager::ComputeNextAutoUpdateTime(
 
   rv = info->GetNextUpdate(&nextUpdate);
   if (NS_FAILED(rv))
     return rv;
 
   switch (autoUpdateType) {
   case TYPE_AUTOUPDATE_FREQ_BASED:
     diff = now - lastUpdate;                    //diff is the no of micro sec between now and last update
-    LL_DIV(cycleCnt, diff, microsecInDayCnt);   //temp is the number of full cycles from lst update
+    cycleCnt = diff / microsecInDayCnt;       //temp is the number of full cycles from lst update
     LL_MOD(temp, diff, microsecInDayCnt);
     if(temp != 0) {
       ++cycleCnt;            //no of complete cycles till next autoupdate instant
     }
     temp = cycleCnt * microsecInDayCnt;    //micro secs from last update
     tempTime = lastUpdate + temp;
     break;  
   case TYPE_AUTOUPDATE_TIME_BASED:
--- a/tools/trace-malloc/spacetrace.c
+++ b/tools/trace-malloc/spacetrace.c
@@ -114,17 +114,17 @@ ticks2xsec(tmreader * aReader, uint32_t 
     uint32_t retval = 0;
     uint64_t bigone;
     uint64_t tmp64;
 
     LL_UI2L(bigone, aResolution);
     LL_UI2L(tmp64, aTicks);
     bigone *= tmp64;
     LL_UI2L(tmp64, aReader->ticksPerSec);
-    LL_DIV(bigone, bigone, tmp64);
+    bigone /= tmp64;
     LL_L2UI(retval, bigone);
     return retval;
 }
 
 #define ticks2msec(reader, ticks) ticks2xsec((reader), (ticks), 1000)
 #define ticks2usec(reader, ticks) ticks2xsec((reader), (ticks), 1000000)
 
 /*
@@ -2040,17 +2040,17 @@ optionGetDataOut(PRFileDesc * inFD, STOp
 #define ST_WEB_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help) \
     PR_fprintf(inFD, "%s%s=%u", (0 == mark++) ? "?" : "&", #option_name, inOptions->m##option_name / multiplier);
 #define ST_WEB_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help) \
     { \
         uint64_t def64 = default_value; \
         uint64_t mul64 = multiplier; \
         uint64_t div64; \
         \
-        LL_DIV(div64, inOptions->m##option_name##64, mul64); \
+        div64 = inOptions->m##option_name##64 / mul64; \
         PR_fprintf(inFD, "%s%s=%llu", (0 == mark++) ? "?" : "&", #option_name, div64); \
     }
 
 #include "stoptions.h"
     }
 }
 
 /*
@@ -3871,17 +3871,17 @@ graphFootprint(STRequest * inRequest, ST
                         /*
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(ydata64, YData[traverse]);
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         LL_I2L(mem64, (maxMemory - minMemory));
 
                         in64 = ydata64 * spacey64;
-                        LL_DIV(in64, in64, mem64);
+                        in64 /= mem64;
                         LL_L2I(in32, in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
@@ -4087,17 +4087,17 @@ graphTimeval(STRequest * inRequest, STRu
                         /*
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(ydata64, YData[traverse]);
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         LL_I2L(mem64, (maxMemory - minMemory));
 
                         in64 = ydata64 * spacey64;
-                        LL_DIV(in64, in64, mem64);
+                        in64 /= mem64;
                         LL_L2I(in32, in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
@@ -4305,17 +4305,17 @@ graphLifespan(STRequest * inRequest, STR
                         /*
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(ydata64, YData[traverse]);
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         LL_I2L(mem64, (maxMemory - minMemory));
 
                         in64 = ydata64 * spacey64;
-                        LL_DIV(in64, in64, mem64);
+                        in64 /= mem64;
                         LL_L2I(in32, in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
@@ -4505,17 +4505,17 @@ graphWeight(STRequest * inRequest, STRun
                         ((globals.mMaxTimeval -
                           globals.mMinTimeval) * percents[traverse]) / 100;
                     PR_snprintf(timevals[traverse], 32, ST_TIMEVAL_FORMAT,
                                 ST_TIMEVAL_PRINTABLE(cached));
 
                     LL_UI2L(percent64, percents[traverse]);
                     result64 = maxWeight64 - minWeight64;
                     result64 *= percent64;
-                    LL_DIV(result64, result64, hundred64);
+                    result64 /= hundred64;
                     PR_snprintf(bytes[traverse], 32, "%llu", result64);
                 }
 
                 red = gdImageColorAllocate(graph, 255, 0, 0);
                 legendColors[0] = red;
 
                 drawGraph(graph, -1, "Allocation Weights", "Seconds",
                           "Weight", 11, percents, (const char **) timevals,
@@ -4537,17 +4537,17 @@ graphWeight(STRequest * inRequest, STRun
 
                         /*
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(spacey64, STGD_SPACE_Y);
                         weight64 = maxWeight64 - minWeight64;
 
                         in64 = YData64[traverse] * spacey64;
-                        LL_DIV(in64, in64, weight64);
+                        in64 /= weight64;
                         LL_L2I(in32, in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
                         gdImageLine(graph, x1, y1, x2, y2, red);
                     }
                 }
@@ -4727,17 +4727,17 @@ displayOptionInt64(STRequest * inRequest
     PR_fprintf(inRequest->mFD, "<input type=submit value=%s>\n", option_name);
 #endif
     PR_fprintf(inRequest->mFD, "<div class=\"option-box\">\n");
     PR_fprintf(inRequest->mFD, "<p class=option-name>%s</p>\n", option_name); {
         uint64_t def64 = default_value;
         uint64_t mul64 = multiplier;
         uint64_t div64;
 
-        LL_DIV(div64, value, mul64);
+        div64 = value / mul64;
         PR_fprintf(inRequest->mFD,
                    "<input type=text name=%s value=%llu>\n",
                    option_name, div64);
         PR_fprintf(inRequest->mFD,
                    "<p class=option-default>Default value is %llu.</p>\n<p class=option-help>%s</p>\n",
                    def64, option_help);
     }
     PR_fprintf(inRequest->mFD, "</div>\n");
--- a/tools/trace-malloc/tmfrags.c
+++ b/tools/trace-malloc/tmfrags.c
@@ -419,17 +419,17 @@ uint32_t ticks2xsec(tmreader* aReader, u
     uint32_t retval = 0;
     uint64_t bigone;
     uint64_t tmp64;
 
     LL_UI2L(bigone, aResolution);
     LL_UI2L(tmp64, aTicks);
     bigone *= tmp64;
     LL_UI2L(tmp64, aReader->ticksPerSec);
-    LL_DIV(bigone, bigone, tmp64);
+    bigone /= tmp64;
     LL_L2UI(retval, bigone);
     return retval;
 }
 
 
 void cleanOptions(Options* inOptions)
 /*
 **  Clean up any open handles.
--- a/tools/trace-malloc/tmstats.c
+++ b/tools/trace-malloc/tmstats.c
@@ -535,17 +535,17 @@ uint32_t ticks2xsec(tmreader* aReader, u
     uint32_t retval = 0;
     uint64_t bigone;
     uint64_t tmp64;
 
     LL_UI2L(bigone, aResolution);
     LL_UI2L(tmp64, aTicks);
     bigone *= tmp64;
     LL_UI2L(tmp64, aReader->ticksPerSec);
-    LL_DIV(bigone, bigone, tmp64);
+    bigone /= tmp64;
     LL_L2UI(retval, bigone);
 
     return retval;
 }
 #define ticks2msec(reader, ticks) ticks2xsec((reader), (ticks), 1000)
 
 
 void tmEventHandler(tmreader* inReader, tmevent* inEvent)
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -55,17 +55,17 @@ static PRLogModuleInfo *gPrefetchLog;
 //-----------------------------------------------------------------------------
 
 static inline uint32_t
 PRTimeToSeconds(PRTime t_usec)
 {
     PRTime usec_per_sec;
     uint32_t t_sec;
     LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
-    LL_DIV(t_usec, t_usec, usec_per_sec);
+    t_usec /= usec_per_sec;
     LL_L2I(t_sec, t_usec);
     return t_sec;
 }
 
 #define NowInSeconds() PRTimeToSeconds(PR_Now())
 
 //-----------------------------------------------------------------------------
 // nsPrefetchQueueEnumerator
--- a/xpcom/io/nsLocalFileOS2.cpp
+++ b/xpcom/io/nsLocalFileOS2.cpp
@@ -1711,17 +1711,17 @@ nsLocalFile::GetLastModifiedTime(PRTime 
     *aLastModifiedTime = 0;
     nsresult rv = Stat();
     if (NS_FAILED(rv))
         return rv;
 
     // microseconds -> milliseconds
     int64_t usecPerMsec;
     LL_I2L(usecPerMsec, PR_USEC_PER_MSEC);
-    LL_DIV(*aLastModifiedTime, mFileInfo64.modifyTime, usecPerMsec);
+    *aLastModifiedTime = mFileInfo64.modifyTime / usecPerMsec;
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -2263,17 +2263,17 @@ nsLocalFile::GetLastModifiedTime(PRTime 
 
     nsresult rv = ResolveAndStat();
     if (NS_FAILED(rv))
         return rv;
 
     // microseconds -> milliseconds
     int64_t usecPerMsec;
     LL_I2L(usecPerMsec, PR_USEC_PER_MSEC);
-    LL_DIV(*aLastModifiedTime, mFileInfo64.modifyTime, usecPerMsec);
+    *aLastModifiedTime = mFileInfo64.modifyTime / usecPerMsec;
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
 {
     // Check we are correctly initialized.
@@ -2287,17 +2287,17 @@ nsLocalFile::GetLastModifiedTimeOfLink(P
     PRFileInfo64 info;
     nsresult rv = GetFileInfo(mWorkingPath, &info);
     if (NS_FAILED(rv)) 
         return rv;
 
     // microseconds -> milliseconds
     int64_t usecPerMsec;
     LL_I2L(usecPerMsec, PR_USEC_PER_MSEC);
-    LL_DIV(*aLastModifiedTime, info.modifyTime, usecPerMsec);
+    *aLastModifiedTime = info.modifyTime / usecPerMsec;
     return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsLocalFile::SetLastModifiedTime(PRTime aLastModifiedTime)
 {
     // Check we are correctly initialized.
--- a/xpcom/tests/CvtURL.cpp
+++ b/xpcom/tests/CvtURL.cpp
@@ -73,18 +73,17 @@ int main(int argc, char** argv)
       break;
     }
     if (nb == 0) break; // EOF
     count += nb;
   }
   PRTime end = PR_Now();
   PRTime conversion, ustoms;
   LL_I2L(ustoms, 1000);
-  conversion = end - start;
-  LL_DIV(conversion, conversion, ustoms);
+  conversion = (end - start) / ustoms;
   char buf[500];
   PR_snprintf(buf, sizeof(buf),
               "converting and discarding %d bytes took %lldms",
               count, conversion);
   puts(buf);
 
   // Release the objects
   in->Release();