Bug 792581 - part 10: Replace LL_SUB macro with mathematical minus operator. r=ehsan

This commit is contained in:
Andrew Quartey 2012-10-05 01:05:27 -04:00
parent 5fcf688c9c
commit 1839819e70
11 changed files with 16 additions and 21 deletions

View File

@ -1229,9 +1229,9 @@ nsContentSink::Notify(nsITimer *timer)
int32_t delay;
LL_I2L(interval, GetNotificationInterval());
LL_SUB(diff, now, mLastNotificationTime);
diff = now - mLastNotificationTime;
LL_SUB(diff, diff, interval);
diff -= interval;
LL_L2I(delay, diff);
delay /= PR_USEC_PER_MSEC;
@ -1273,7 +1273,7 @@ nsContentSink::IsTimeToNotify()
int64_t interval, diff;
LL_I2L(interval, GetNotificationInterval());
LL_SUB(diff, now, mLastNotificationTime);
diff = now - mLastNotificationTime;
if (diff > interval) {
mBackoffCount--;

View File

@ -691,9 +691,7 @@ nsXULTemplateQueryProcessorRDF::CompareResults(nsIXULTemplateResult* aLeft,
l->GetValue(&ldate);
r->GetValue(&rdate);
int64_t delta;
LL_SUB(delta, ldate, rdate);
int64_t delta = ldate - rdate;
if (delta == 0)
*aResult = 0;
else if (delta >= 0)

View File

@ -1237,7 +1237,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
if (!numLines) numLines = 1;
PRTime delta, perLineDelta, lines;
LL_I2L(lines, numLines);
LL_SUB(delta, end, start);
delta = end - start;
LL_DIV(perLineDelta, delta, lines);
ListTag(stdout);
@ -6208,7 +6208,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (!numLines) numLines = 1;
PRTime lines, deltaPerLine, delta;
LL_I2L(lines, numLines);
LL_SUB(delta, end, start);
delta = end - start;
LL_DIV(deltaPerLine, delta, lines);
ListTag(stdout);

View File

@ -3371,7 +3371,7 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
PRTime now = PR_Now();
char buf[50];
PRTime delta;
LL_SUB(delta, now, gLastTick);
delta = now - gLastTick;
gLastTick = now;
PR_snprintf(buf, sizeof(buf), "%lldusec", delta);
printf("%s\n", buf);

View File

@ -907,8 +907,7 @@ nsListBoxBodyFrame::DoInternalPositionChanged(bool aUp, int32_t aDelta)
PRTime end = PR_Now();
PRTime difTime;
LL_SUB(difTime, end, start);
PRTime difTime = end - start;
int32_t newTime;
LL_L2I(newTime, difTime);

View File

@ -779,8 +779,7 @@ nsProtocolProxyService::SecondsSinceSessionStart()
PRTime now = PR_Now();
// get time elapsed since session start
int64_t diff;
LL_SUB(diff, now, mSessionStart);
int64_t diff = now - mSessionStart;
// convert microseconds to seconds
PRTime ups;

View File

@ -353,8 +353,7 @@ int main(int argc, char **argv)
finish = PR_Now();
uint32_t totalTime32;
uint64_t totalTime64;
LL_SUB(totalTime64, finish, start);
uint64_t totalTime64 = finish - start;
LL_L2UI(totalTime32, totalTime64);
printf("\n\n--------------------\nAll done:\nnum found:%d\nnum start:%d\n", numFound, numStart);

View File

@ -415,7 +415,7 @@ nsCRLManager::ComputeNextAutoUpdateTime(nsICRLInfo *info,
switch (autoUpdateType) {
case TYPE_AUTOUPDATE_FREQ_BASED:
LL_SUB(diff, now, lastUpdate); //diff is the no of micro sec between now and last update
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
LL_MOD(temp, diff, microsecInDayCnt);
if(temp != 0) {
@ -425,7 +425,7 @@ nsCRLManager::ComputeNextAutoUpdateTime(nsICRLInfo *info,
tempTime = lastUpdate + temp;
break;
case TYPE_AUTOUPDATE_TIME_BASED:
LL_SUB(tempTime, nextUpdate, microsecInDayCnt);
tempTime = nextUpdate - microsecInDayCnt;
break;
default:
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -1416,7 +1416,7 @@ nsNSSComponent::DefineNextTimer()
//Define the firing interval, from NOW
if ( now < nextFiring) {
LL_SUB(diff,nextFiring,now);
diff = nextFiring - now;
LL_L2UI(interval, diff);
//Now, we are doing 32 operations - so, don't need LL_ functions...
interval = interval/PR_USEC_PER_MSEC;

View File

@ -4508,7 +4508,7 @@ graphWeight(STRequest * inRequest, STRun * aRun)
ST_TIMEVAL_PRINTABLE(cached));
LL_UI2L(percent64, percents[traverse]);
LL_SUB(result64, maxWeight64, minWeight64);
result64 = maxWeight64 - minWeight64;
LL_MUL(result64, result64, percent64);
LL_DIV(result64, result64, hundred64);
PR_snprintf(bytes[traverse], 32, "%llu", result64);
@ -4539,7 +4539,7 @@ graphWeight(STRequest * inRequest, STRun * aRun)
** Need to do this math in 64 bits.
*/
LL_I2L(spacey64, STGD_SPACE_Y);
LL_SUB(weight64, maxWeight64, minWeight64);
weight64 = maxWeight64 - minWeight64;
LL_MUL(in64, YData64[traverse], spacey64);
LL_DIV(in64, in64, weight64);

View File

@ -78,7 +78,7 @@ int main(int argc, char** argv)
PRTime end = PR_Now();
PRTime conversion, ustoms;
LL_I2L(ustoms, 1000);
LL_SUB(conversion, end, start);
conversion = end - start;
LL_DIV(conversion, conversion, ustoms);
char buf[500];
PR_snprintf(buf, sizeof(buf),