Bug 792581 - part 19: Replace LL_I2L macro with int64_t cast. r=ehsan

This commit is contained in:
Andrew Quartey 2012-10-12 13:29:11 -04:00
Родитель 8191e9c8c1
Коммит 00edc52f9c
17 изменённых файлов: 42 добавлений и 68 удалений

Просмотреть файл

@ -1225,9 +1225,8 @@ nsContentSink::Notify(nsITimer *timer)
#ifdef MOZ_DEBUG
{
PRTime now = PR_Now();
int64_t interval;
LL_I2L(interval, GetNotificationInterval());
int64_t interval = GetNotificationInterval();
delay = int32_t(now - mLastNotificationTime - interval) / PR_USEC_PER_MSEC;
mBackoffCount--;

Просмотреть файл

@ -6874,9 +6874,7 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
rv = file->GetLastModifiedTime(&msecs);
if (NS_SUCCEEDED(rv)) {
int64_t intermediateValue;
LL_I2L(intermediateValue, PR_USEC_PER_MSEC);
modDate = msecs * intermediateValue;
modDate = msecs * int64_t(PR_USEC_PER_MSEC);
}
}
} else {

Просмотреть файл

@ -532,10 +532,8 @@ protected:
static inline uint32_t
PRTimeToSeconds(PRTime t_usec)
{
PRTime usec_per_sec;
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
t_usec /= usec_per_sec;
return uint32_t(t_usec);
PRTime usec_per_sec = PR_USEC_PER_SEC;
return uint32_t(t_usec /= usec_per_sec);
}
bool IsFrame();

Просмотреть файл

@ -1236,7 +1236,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
int32_t numLines = mLines.size();
if (!numLines) numLines = 1;
PRTime delta, perLineDelta, lines;
LL_I2L(lines, numLines);
lines = int64_t(numLines);
delta = end - start;
perLineDelta = delta / lines;
@ -6207,7 +6207,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
int32_t numLines = mLines.size();
if (!numLines) numLines = 1;
PRTime lines, deltaPerLine, delta;
LL_I2L(lines, numLines);
lines = int64_t(numLines);
delta = end - start;
deltaPerLine = delta / lines;

Просмотреть файл

@ -782,9 +782,7 @@ nsProtocolProxyService::SecondsSinceSessionStart()
int64_t diff = now - mSessionStart;
// convert microseconds to seconds
PRTime ups;
LL_I2L(ups, PR_USEC_PER_SEC);
diff /= ups;
diff /= PR_USEC_PER_SEC;
// return converted 32 bit value
return uint32_t(diff);

9
netwerk/cache/nsCache.cpp поставляемый
Просмотреть файл

@ -45,8 +45,7 @@ CacheLogPrintPath(PRLogModuleLevel level, const char * format, nsIFile * item)
uint32_t
SecondsFromPRTime(PRTime prTime)
{
int64_t microSecondsPerSecond;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
int64_t microSecondsPerSecond = PR_USEC_PER_SEC;
return uint32_t(prTime / microSecondsPerSecond);
}
@ -54,12 +53,10 @@ SecondsFromPRTime(PRTime prTime)
PRTime
PRTimeFromSeconds(uint32_t seconds)
{
int64_t microSecondsPerSecond, intermediateResult;
PRTime prTime;
int64_t intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(intermediateResult, seconds);
prTime = intermediateResult * microSecondsPerSecond;
PRTime prTime = intermediateResult * PR_USEC_PER_SEC;
return prTime;
}

Просмотреть файл

@ -88,9 +88,7 @@ MoveCList(PRCList &from, PRCList &to)
static uint32_t
NowInMinutes()
{
PRTime now = PR_Now(), factor;
LL_I2L(factor, 60 * PR_USEC_PER_SEC);
return uint32_t(now / factor);
return uint32_t(PR_Now() / int64_t(60 * PR_USEC_PER_SEC));
}
//----------------------------------------------------------------------------

Просмотреть файл

@ -21,10 +21,9 @@
static PRTime SecondsToPRTime(uint32_t t_sec)
{
PRTime t_usec, usec_per_sec;
LL_I2L(t_usec, t_sec);
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
t_usec *= usec_per_sec;
return t_usec;
t_usec = t_sec;
usec_per_sec = PR_USEC_PER_SEC;
return t_usec *= usec_per_sec;
}
static void PrintTimeString(char *buf, uint32_t bufsize, uint32_t t_sec)
{

Просмотреть файл

@ -178,10 +178,9 @@ nsAboutCacheEntry::OpenCacheEntry(nsIURI *uri)
static PRTime SecondsToPRTime(uint32_t t_sec)
{
PRTime t_usec, usec_per_sec;
LL_I2L(t_usec, t_sec);
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
t_usec *= usec_per_sec;
return t_usec;
t_usec = t_sec;
usec_per_sec = PR_USEC_PER_SEC;
return t_usec *= usec_per_sec;
}
static void PrintTimeString(char *buf, uint32_t bufsize, uint32_t t_sec)
{

Просмотреть файл

@ -3869,9 +3869,9 @@ graphFootprint(STRequest * inRequest, STRun * aRun)
/*
** Need to do this math in 64 bits.
*/
LL_I2L(ydata64, YData[traverse]);
LL_I2L(spacey64, STGD_SPACE_Y);
LL_I2L(mem64, (maxMemory - minMemory));
ydata64 = (int64_t)YData[traverse];
spacey64 = (int64_t)STGD_SPACE_Y;
mem64 = (int64_t)(maxMemory - minMemory);
in64 = ydata64 * spacey64;
in64 /= mem64;
@ -4085,9 +4085,9 @@ graphTimeval(STRequest * inRequest, STRun * aRun)
/*
** Need to do this math in 64 bits.
*/
LL_I2L(ydata64, YData[traverse]);
LL_I2L(spacey64, STGD_SPACE_Y);
LL_I2L(mem64, (maxMemory - minMemory));
ydata64 = (int64_t)YData[traverse];
spacey64 = (int64_t)STGD_SPACE_Y;
mem64 = (int64_t)(maxMemory - minMemory);
in64 = ydata64 * spacey64;
in64 /= mem64;
@ -4303,9 +4303,9 @@ graphLifespan(STRequest * inRequest, STRun * aRun)
/*
** Need to do this math in 64 bits.
*/
LL_I2L(ydata64, YData[traverse]);
LL_I2L(spacey64, STGD_SPACE_Y);
LL_I2L(mem64, (maxMemory - minMemory));
ydata64 = (int64_t)YData[traverse];
spacey64 = (int64_t)STGD_SPACE_Y;
mem64 = (int64_t)(maxMemory - minMemory);
in64 = ydata64 * spacey64;
in64 /= mem64;
@ -4536,7 +4536,7 @@ graphWeight(STRequest * inRequest, STRun * aRun)
/*
** Need to do this math in 64 bits.
*/
LL_I2L(spacey64, STGD_SPACE_Y);
spacey64 = (int64_t)STGD_SPACE_Y;
weight64 = maxWeight64 - minWeight64;
in64 = YData64[traverse] * spacey64;

Просмотреть файл

@ -57,10 +57,8 @@ static PRLogModuleInfo *gPrefetchLog;
static inline uint32_t
PRTimeToSeconds(PRTime t_usec)
{
PRTime usec_per_sec;
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
t_usec /= usec_per_sec;
return uint32_t(t_usec);
PRTime usec_per_sec = PR_USEC_PER_SEC;
return uint32_t(t_usec /= usec_per_sec);
}
#define NowInSeconds() PRTimeToSeconds(PR_Now())

Просмотреть файл

@ -647,7 +647,7 @@ nsVariant::ConvertToInt64(const nsDiscriminatedUnion& data, int64_t *_retval)
switch(tempData.mType)
{
case nsIDataType::VTYPE_INT32:
LL_I2L(*_retval, tempData.u.mInt32Value);
*_retval = tempData.u.mInt32Value;
return rv;
case nsIDataType::VTYPE_UINT32:
LL_UI2L(*_retval, tempData.u.mUint32Value);

Просмотреть файл

@ -287,7 +287,7 @@ static int cvt_ll(SprintfState *ss, int64_t num, int width, int prec,
** need to stop when we hit 10 digits. In the signed case, we can
** stop when the number is zero.
*/
LL_I2L(rad, radix);
rad = radix;
cvt = &cvtbuf[0] + ELEMENTS_OF(cvtbuf);
digits = 0;
while (num != 0) {

Просмотреть файл

@ -1714,9 +1714,7 @@ nsLocalFile::GetLastModifiedTime(PRTime *aLastModifiedTime)
return rv;
// microseconds -> milliseconds
int64_t usecPerMsec;
LL_I2L(usecPerMsec, PR_USEC_PER_MSEC);
*aLastModifiedTime = mFileInfo64.modifyTime / usecPerMsec;
*aLastModifiedTime = mFileInfo64.modifyTime / PR_USEC_PER_MSEC;
return NS_OK;
}

Просмотреть файл

@ -2266,9 +2266,7 @@ nsLocalFile::GetLastModifiedTime(PRTime *aLastModifiedTime)
return rv;
// microseconds -> milliseconds
int64_t usecPerMsec;
LL_I2L(usecPerMsec, PR_USEC_PER_MSEC);
*aLastModifiedTime = mFileInfo64.modifyTime / usecPerMsec;
*aLastModifiedTime = mFileInfo64.modifyTime / PR_USEC_PER_MSEC;
return NS_OK;
}
@ -2290,9 +2288,7 @@ nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModifiedTime)
return rv;
// microseconds -> milliseconds
int64_t usecPerMsec;
LL_I2L(usecPerMsec, PR_USEC_PER_MSEC);
*aLastModifiedTime = info.modifyTime / usecPerMsec;
*aLastModifiedTime = info.modifyTime / PR_USEC_PER_MSEC;
return NS_OK;
}

Просмотреть файл

@ -323,9 +323,7 @@ int main()
printf("\t1 + 1 = %d\n", out);
else
printf("\tFAILED");
int64_t one, two;
LL_I2L(one, 1);
LL_I2L(two, 2);
int64_t one = 1, two = 2;
if(NS_SUCCEEDED(test->AddTwoLLs(one,one,&out64)))
{
tmp32 = (int)out64;
@ -435,15 +433,15 @@ int main()
else
printf("\tFAILED");
LL_I2L(var[0].val.i64, 1);
var[0].val.i64 = 1;
var[0].type = nsXPTType::T_I64;
var[0].flags = 0;
LL_I2L(var[1].val.i64, 1);
var[1].val.i64 = 1;
var[1].type = nsXPTType::T_I64;
var[1].flags = 0;
LL_I2L(var[2].val.i64, 0);
var[2].val.i64 = 0;
var[2].type = nsXPTType::T_I64;
var[2].flags = nsXPTCVariant::PTR_IS_DATA;
var[2].ptr = &var[2].val.i64;
@ -471,15 +469,15 @@ int main()
else
printf("\tFAILED");
LL_I2L(var[0].val.i64,2);
var[0].val.i64 = 2;
var[0].type = nsXPTType::T_I64;
var[0].flags = 0;
LL_I2L(var[1].val.i64,2);
var[1].val.i64 = 2;
var[1].type = nsXPTType::T_I64;
var[1].flags = 0;
LL_I2L(var[2].val.i64,0);
var[2].val.i64 = 0;
var[2].type = nsXPTType::T_I64;
var[2].flags = nsXPTCVariant::PTR_IS_DATA;
var[2].ptr = &var[2].val.i64;

Просмотреть файл

@ -76,9 +76,7 @@ int main(int argc, char** argv)
count += nb;
}
PRTime end = PR_Now();
PRTime conversion, ustoms;
LL_I2L(ustoms, 1000);
conversion = (end - start) / ustoms;
PRTime conversion = (end - start) / 1000;
char buf[500];
PR_snprintf(buf, sizeof(buf),
"converting and discarding %d bytes took %lldms",