Bug 792581 - part 23: Replace LL_INIT and LL_UDIVMOD macros. r=ehsan

This commit is contained in:
Andrew Quartey 2012-11-01 20:57:25 -04:00
parent dac41839af
commit d21a5d8004
9 changed files with 51 additions and 63 deletions

View File

@ -3666,7 +3666,7 @@ MaxScriptRunTimePrefChangedCallback(const char *aPrefName, void *aClosure)
PRTime t;
if (time <= 0) {
// Let scripts run for a really, really long time.
t = LL_INIT(0x40000000, 0);
t = 0x40000000LL << 32;
} else {
t = time * PR_USEC_PER_SEC;
}

View File

@ -37,7 +37,7 @@ gfxUserFontSet::GetUserFontsLog()
#define LOG(args) PR_LOG(GetUserFontsLog(), PR_LOG_DEBUG, args)
#define LOG_ENABLED() PR_LOG_TEST(GetUserFontsLog(), PR_LOG_DEBUG)
static uint64_t sFontSetGeneration = LL_INIT(0, 0);
static uint64_t sFontSetGeneration = 0;
// TODO: support for unicode ranges not yet implemented

View File

@ -240,12 +240,8 @@ struct DateHashEntry : public PLDHashEntryHdr {
{
// xor the low 32 bits with the high 32 bits.
PRTime t = *static_cast<const PRTime *>(key);
int64_t h64, l64;
h64 = t >> 32;
l64 = LL_INIT(0, 0xffffffff);
l64 &= t;
int32_t h32 = int32_t(h64);
int32_t l32 = int32_t(l64);
int32_t h32 = int32_t(t >> 32);
int32_t l32 = int32_t(0xffffffff & t);
return PLDHashNumber(l32 ^ h32);
}

View File

@ -100,8 +100,7 @@ using namespace mozilla::places;
// for repeating stuff. These are milliseconds between "now" cache refreshes.
#define RENEW_CACHED_NOW_TIMEOUT ((int32_t)3 * PR_MSEC_PER_SEC)
// USECS_PER_DAY == PR_USEC_PER_SEC * 60 * 60 * 24;
static const int64_t USECS_PER_DAY = LL_INIT(20, 500654080);
static const int64_t USECS_PER_DAY = PR_USEC_PER_SEC * 60 * 60 * 24;
// character-set annotation
#define CHARSET_ANNO NS_LITERAL_CSTRING("URIProperties/characterSet")

View File

@ -650,14 +650,10 @@ recalculateAllocationCost(STOptions * inOptions, STContext * inContext,
uint32_t timeval =
aAllocation->mMaxTimeval - aAllocation->mMinTimeval;
uint32_t size = byteSize(inOptions, aAllocation);
uint64_t weight64 = LL_INIT(0, 0);
uint32_t heapCost = aAllocation->mHeapRuntimeCost;
uint64_t timeval64 = LL_INIT(0, 0);
uint64_t size64 = LL_INIT(0, 0);
timeval64 = timeval;
size64 = size;
weight64 = timeval64 * size64;
uint64_t timeval64 = timeval;
uint64_t size64 = size;
uint64_t weight64 = timeval64 * size64;
/*
** First, update this run.
@ -888,9 +884,9 @@ harvestRun(const STRun * aInRun, STRun * aOutRun,
if (NULL != current) {
uint32_t lifetime = 0;
uint32_t bytesize = 0;
uint64_t weight64 = LL_INIT(0, 0);
uint64_t bytesize64 = LL_INIT(0, 0);
uint64_t lifetime64 = LL_INIT(0, 0);
uint64_t weight64 = 0;
uint64_t bytesize64 = 0;
uint64_t lifetime64 = 0;
int appendRes = 0;
int looper = 0;
PRBool matched = PR_FALSE;
@ -1077,12 +1073,12 @@ compareAllocations(const void *aAlloc1, const void *aAlloc2, void *aContext)
*/
case ST_WEIGHT:
{
uint64_t weight164 = LL_INIT(0, 0);
uint64_t weight264 = LL_INIT(0, 0);
uint64_t bytesize164 = LL_INIT(0, 0);
uint64_t bytesize264 = LL_INIT(0, 0);
uint64_t timeval164 = LL_INIT(0, 0);
uint64_t timeval264 = LL_INIT(0, 0);
uint64_t weight164 = 0;
uint64_t weight264 = 0;
uint64_t bytesize164 = 0;
uint64_t bytesize264 = 0;
uint64_t timeval164 = 0;
uint64_t timeval264 = 0;
bytesize164 = byteSize(inOptions, alloc1);
timeval164 = alloc1->mMaxTimeval - alloc1->mMinTimeval;
@ -2601,7 +2597,7 @@ getDataPRUint64(const FormData * aGetData, const char *aCheckFor, int inIndex,
uint64_t * aStoreResult64, uint64_t aConversion64)
{
int retval = 0;
uint64_t value64 = LL_INIT(0, 0);
uint64_t value64 = 0;
retval = getDataPRUint32Base(aGetData, aCheckFor, inIndex, &value64, 64);
*aStoreResult64 = value64 * aConversion64;
@ -2703,7 +2699,7 @@ displayTopAllocations(STRequest * inRequest, STRun * aRun,
current->mMaxTimeval - current->mMinTimeval;
uint32_t size = byteSize(&inRequest->mOptions, current);
uint32_t heapCost = current->mHeapRuntimeCost;
uint64_t weight64 = LL_INIT(0, 0);
uint64_t weight64 = 0;
char buffer[32];
weight64 =(uint64_t)(size * lifespan);
@ -2823,7 +2819,7 @@ displayMemoryLeaks(STRequest * inRequest, STRun * aRun)
current->mMaxTimeval - current->mMinTimeval;
uint32_t size = byteSize(&inRequest->mOptions, current);
uint32_t heapCost = current->mHeapRuntimeCost;
uint64_t weight64 = LL_INIT(0, 0);
uint64_t weight64 = 0;
char buffer[32];
weight64 =(uint64_t)(size * lifespan);
@ -3077,7 +3073,7 @@ displayAllocationDetails(STRequest * inRequest, STAllocation * aAllocation)
uint32_t timeval =
aAllocation->mMaxTimeval - aAllocation->mMinTimeval;
uint32_t heapCost = aAllocation->mHeapRuntimeCost;
uint64_t weight64 = LL_INIT(0, 0);
uint64_t weight64 = 0;
uint32_t cacheval = 0;
int displayRes = 0;
@ -3829,10 +3825,10 @@ graphFootprint(STRequest * inRequest, STRun * aRun)
legends);
if (maxMemory != minMemory) {
int64_t in64 = LL_INIT(0, 0);
int64_t ydata64 = LL_INIT(0, 0);
int64_t spacey64 = LL_INIT(0, 0);
int64_t mem64 = LL_INIT(0, 0);
int64_t in64 = 0;
int64_t ydata64 = 0;
int64_t spacey64 = 0;
int64_t mem64 = 0;
int32_t in32 = 0;
/*
@ -4045,10 +4041,10 @@ graphTimeval(STRequest * inRequest, STRun * aRun)
legends);
if (maxMemory != minMemory) {
int64_t in64 = LL_INIT(0, 0);
int64_t ydata64 = LL_INIT(0, 0);
int64_t spacey64 = LL_INIT(0, 0);
int64_t mem64 = LL_INIT(0, 0);
int64_t in64 = 0;
int64_t ydata64 = 0;
int64_t spacey64 = 0;
int64_t mem64 = 0;
int32_t in32 = 0;
/*
@ -4263,10 +4259,10 @@ graphLifespan(STRequest * inRequest, STRun * aRun)
legends);
if (maxMemory != minMemory) {
int64_t in64 = LL_INIT(0, 0);
int64_t ydata64 = LL_INIT(0, 0);
int64_t spacey64 = LL_INIT(0, 0);
int64_t mem64 = LL_INIT(0, 0);
int64_t in64 = 0;
int64_t ydata64 = 0;
int64_t spacey64 = 0;
int64_t mem64 = 0;
int32_t in32 = 0;
/*
@ -4392,9 +4388,9 @@ graphWeight(STRequest * inRequest, STRun * aRun)
for (loop = 0; loop < aRun->mAllocationCount; loop++) {
if (prevTimeval < aRun->mAllocations[loop]->mMinTimeval
&& timeval >= aRun->mAllocations[loop]->mMinTimeval) {
uint64_t size64 = LL_INIT(0, 0);
uint64_t lifespan64 = LL_INIT(0, 0);
uint64_t weight64 = LL_INIT(0, 0);
uint64_t size64 = 0;
uint64_t lifespan64 = 0;
uint64_t weight64 = 0;
size64 = byteSize(&inRequest->mOptions,
aRun->mAllocations[loop]);
@ -4423,8 +4419,8 @@ graphWeight(STRequest * inRequest, STRun * aRun)
}
if (0 == retval) {
uint64_t minWeight64 = LL_INIT(0xFFFFFFFF, 0xFFFFFFFF);
uint64_t maxWeight64 = LL_INIT(0, 0);
uint64_t minWeight64 = (0xFFFFFFFFLL << 32) + 0xFFFFFFFFLL;
uint64_t maxWeight64 = 0;
int transparent = 0;
gdImagePtr graph = NULL;
@ -4459,8 +4455,8 @@ graphWeight(STRequest * inRequest, STRun * aRun)
char byteSpace[11][32];
int legendColors[1];
const char *legends[1] = { "Memory Weight" };
uint64_t percent64 = LL_INIT(0, 0);
uint64_t result64 = LL_INIT(0, 0);
uint64_t percent64 = 0;
uint64_t result64 = 0;
uint32_t cached = 0;
uint64_t hundred64 = 100;
@ -4492,9 +4488,9 @@ graphWeight(STRequest * inRequest, STRun * aRun)
legendColors, legends);
if (maxWeight64 != minWeight64) {
int64_t in64 = LL_INIT(0, 0);
int64_t spacey64 = LL_INIT(0, 0);
int64_t weight64 = LL_INIT(0, 0);
int64_t in64 = 0;
int64_t spacey64 = 0;
int64_t weight64 = 0;
int32_t in32 = 0;
/*

View File

@ -222,14 +222,14 @@ ST_ALL_OPTION_UINT32(ListItemMax,
ST_ALL_OPTION_UINT64(WeightMin,
DataSetGenre,
LL_INIT(0, 0),
LL_INIT(0, 1),
0,
1,
"Exclude allocations that are below this weight (lifespan * size).\n")
ST_ALL_OPTION_UINT64(WeightMax,
DataSetGenre,
LL_INIT(0xFFFFFFFF, 0xFFFFFFFF),
LL_INIT(0, 1),
(0xFFFFFFFFLL << 32) + 0xFFFFFFFFLL,
1,
"Exclude allocations that are above this weight (lifespan * size).\n")
ST_CMD_OPTION_STRING(FileName,

View File

@ -176,7 +176,7 @@ DataStruct::ReadCache(nsISupports** aData, uint32_t* aDataLen)
if ( cacheFile && NS_SUCCEEDED(cacheFile->Exists(&exists)) && exists ) {
// get the size of the file
int64_t fileSize;
int64_t max32(LL_INIT(0, 0xFFFFFFFF));
int64_t max32 = 0xFFFFFFFF;
cacheFile->GetFileSize(&fileSize);
if (fileSize > max32)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -291,12 +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) {
int64_t quot, rem;
LL_UDIVMOD(&quot, &rem, num, rad);
int32_t digit = int32_t(rem);
*--cvt = hexp[digit & 0xf];
*--cvt = hexp[int32_t(num % rad) & 0xf];
digits++;
num = quot;
num /= rad;
}
if (digits == 0) {
*--cvt = '0';

View File

@ -691,7 +691,7 @@ bool test_appendint64()
int64_t min = INT64_MIN;
static const char min_expected[] = "-9223372036854775808";
static const char min_expected_oct[] = "1000000000000000000000";
int64_t maxint_plus1 = LL_INIT(1, 0);
int64_t maxint_plus1 = 1LL << 32;
static const char maxint_plus1_expected[] = "4294967296";
static const char maxint_plus1_expected_x[] = "100000000";