Bug 792581 - part 15: Replace LL_L2I macro with int32_t cast. r=ehsan

This commit is contained in:
Andrew Quartey 2012-10-12 13:29:10 -04:00
parent 7d3807c62d
commit 790ec84feb
11 changed files with 26 additions and 44 deletions

View File

@ -1225,15 +1225,10 @@ nsContentSink::Notify(nsITimer *timer)
#ifdef MOZ_DEBUG
{
PRTime now = PR_Now();
int64_t diff, interval;
int32_t delay;
int64_t interval;
LL_I2L(interval, GetNotificationInterval());
diff = now - mLastNotificationTime;
diff -= interval;
LL_L2I(delay, diff);
delay /= PR_USEC_PER_MSEC;
delay = int32_t(now - mLastNotificationTime - interval) / PR_USEC_PER_MSEC;
mBackoffCount--;
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,

View File

@ -533,11 +533,9 @@ protected:
PRTimeToSeconds(PRTime t_usec)
{
PRTime usec_per_sec;
uint32_t t_sec;
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
t_usec /= usec_per_sec;
LL_L2I(t_sec, t_usec);
return t_sec;
return uint32_t(t_usec);
}
bool IsFrame();

View File

@ -907,11 +907,7 @@ nsListBoxBodyFrame::DoInternalPositionChanged(bool aUp, int32_t aDelta)
PRTime end = PR_Now();
PRTime difTime = end - start;
int32_t newTime;
LL_L2I(newTime, difTime);
newTime /= aDelta;
int32_t newTime = int32_t(end - start) / aDelta;
// average old and new
mTimePerRow = (newTime + mTimePerRow)/2;

View File

@ -244,9 +244,8 @@ struct DateHashEntry : public PLDHashEntryHdr {
h64 = t >> 32;
l64 = LL_INIT(0, 0xffffffff);
l64 &= t;
int32_t h32, l32;
LL_L2I(h32, h64);
LL_L2I(l32, l64);
int32_t h32 = int32_t(h64);
int32_t l32 = int32_t(l64);
return PLDHashNumber(l32 ^ h32);
}

View File

@ -1192,9 +1192,7 @@ FileSystemDataSource::GetFileSize(nsIRDFResource *source, nsIRDFInt **aResult)
return(rv);
// convert 64bits to 32bits
int32_t aFileSize32 = 0;
LL_L2I(aFileSize32, aFileSize64);
int32_t aFileSize32 = int32_t(aFileSize64);
mRDFService->GetIntLiteral(aFileSize32, aResult);
return(NS_OK);

View File

@ -3877,7 +3877,7 @@ graphFootprint(STRequest * inRequest, STRun * aRun)
in64 = ydata64 * spacey64;
in64 /= mem64;
LL_L2I(in32, in64);
in32 = int32_t(in64);
x2 = x1;
y2 = y1 - in32;
@ -4093,7 +4093,7 @@ graphTimeval(STRequest * inRequest, STRun * aRun)
in64 = ydata64 * spacey64;
in64 /= mem64;
LL_L2I(in32, in64);
in32 = int32_t(in64);
x2 = x1;
y2 = y1 - in32;
@ -4311,7 +4311,7 @@ graphLifespan(STRequest * inRequest, STRun * aRun)
in64 = ydata64 * spacey64;
in64 /= mem64;
LL_L2I(in32, in64);
in32 = int32_t(in64);
x2 = x1;
y2 = y1 - in32;
@ -4543,7 +4543,7 @@ graphWeight(STRequest * inRequest, STRun * aRun)
in64 = YData64[traverse] * spacey64;
in64 /= weight64;
LL_L2I(in32, in64);
in32 = int32_t(in64);
x2 = x1;
y2 = y1 - in32;

View File

@ -58,11 +58,9 @@ 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);
t_usec /= usec_per_sec;
LL_L2I(t_sec, t_usec);
return t_sec;
return uint32_t(t_usec);
}
#define NowInSeconds() PRTimeToSeconds(PR_Now())

View File

@ -291,10 +291,9 @@ static int cvt_ll(SprintfState *ss, int64_t num, int width, int prec,
cvt = &cvtbuf[0] + ELEMENTS_OF(cvtbuf);
digits = 0;
while (num != 0) {
int32_t digit;
int64_t quot, rem;
LL_UDIVMOD(&quot, &rem, num, rad);
LL_L2I(digit, rem);
int32_t digit = int32_t(rem);
*--cvt = hexp[digit & 0xf];
digits++;
num = quot;

View File

@ -89,12 +89,12 @@ myLL_L2II(int64_t result, int32_t *hi, int32_t *lo )
// shift the hi word to the low word, then push it into a long.
a64 = result >> 32;
LL_L2I(*hi, a64);
*hi = int32_t(a64);
// shift the low word to the hi word first, then shift it back.
b64 = result << 32;
a64 = b64 >> 32;
LL_L2I(*lo, a64);
*lo = int32_t(a64);
}
// Locates the first occurrence of charToSearchFor in the stringToSearch

View File

@ -328,8 +328,8 @@ int main()
LL_I2L(two, 2);
if(NS_SUCCEEDED(test->AddTwoLLs(one,one,&out64)))
{
LL_L2I(tmp32, out64);
printf("\t1L + 1L = %d\n", (int)tmp32);
tmp32 = (int)out64;
printf("\t1L + 1L = %d\n", tmp32);
}
else
printf("\tFAILED");
@ -339,8 +339,8 @@ int main()
printf("\tFAILED");
if(NS_SUCCEEDED(test->MultTwoLLs(two,two,&out64)))
{
LL_L2I(tmp32, out64);
printf("\t2L * 2L = %d\n", (int)tmp32);
tmp32 = (int)out64;
printf("\t2L * 2L = %d\n", tmp32);
}
else
printf("\tFAILED");
@ -377,24 +377,24 @@ int main()
if(NS_SUCCEEDED(test->AddMixedInts(1,2,3,4,5,6,7,8,9,10,&out64)))
{
LL_L2I(tmp32, out64);
printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32);
tmp32 = (int)out64;
printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", tmp32);
}
else
printf("\tFAILED");
if(NS_SUCCEEDED(test->AddMixedInts2(1,2,3,4,5,6,7,8,9,10,&out64)))
{
LL_L2I(tmp32, out64);
printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", (int)tmp32);
tmp32 = (int)out64;
printf("\t1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = %d\n", tmp32);
}
else
printf("\tFAILED");
if(NS_SUCCEEDED(test->AddMixedInts3(3,5,7,11,13,17,19,23,29,31,&out64)))
{
LL_L2I(tmp32, out64);
printf("\t3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 = %d\n", (int)tmp32);
tmp32 = (int)out64;
printf("\t3 + 5 + 7 + 11 + 13 + 17 + 19 + 23 + 29 + 31 = %d\n", tmp32);
}
else
printf("\tFAILED");

View File

@ -436,8 +436,7 @@ nsHTTPIndex::OnIndexAvailable(nsIRequest* aRequest, nsISupports *aContext,
if (NS_FAILED(rv)) return rv;
int64_t minus1 = UINT64_MAX;
if (size != minus1) {
int32_t intSize;
LL_L2I(intSize, size);
int32_t intSize = int32_t(size);
// XXX RDF should support 64 bit integers (bug 240160)
nsCOMPtr<nsIRDFInt> val;
rv = mDirRDF->GetIntLiteral(intSize, getter_AddRefs(val));