PRUint32 size1 = 0; PRUint32 size2 = 0;   #if defined(XP_WIN32) && defined(_MSC_VER) size1 = alloc1->mEvents[alloc1->mEventCount - 1].mHeapSize; size2 = alloc2->mEvents[alloc2->mEventCount - 1].mHeapSize; #else size1 = byteSize(alloc1); size2 = byteSize(alloc2); #endif
PRUint32 size1 = byteSize(alloc1); PRUint32 size2 = byteSize(alloc2);
int compareAllocations(const void* aAlloc1, const void* aAlloc2){    int retval = 0;    if(NULL != aAlloc1 && NULL != aAlloc2)    {        STAllocation* alloc1 = *((STAllocation**)aAlloc1);        STAllocation* alloc2 = *((STAllocation**)aAlloc2);        if(NULL != alloc1 && NULL != alloc2)        {            /*            ** Logic determined by pref/option.            */            switch(globals.mOptions.mOrderBy)            {                case ST_WEIGHT:                {                    PRUint64 weight164 = LL_INIT(0, 0);                    PRUint64 weight264 = LL_INIT(0, 0);                    LL_MUL(weight164, (PRUint64)byteSize(alloc1), (PRUint64)(alloc1->mMaxTimeval - alloc1->mMinTimeval));                    LL_MUL(weight264, (PRUint64)byteSize(alloc2), (PRUint64)(alloc2->mMaxTimeval - alloc2->mMinTimeval));                    if(LL_UCMP(weight164, <, weight264))                    {                        retval = __LINE__;                    }                    else if(LL_UCMP(weight164, >, weight264))                    {                        retval = - __LINE__;                    }                }                break;                case ST_SIZE:                {                    PRUint32 size1 = 0;                    PRUint32 size2 = 0;                    /*                    ** MSVC's qsort is so freaking slow on this, use the raw                    **  numbers to help out....                    ** They seem to have a breakdown regarding the uniqueness                    **  of the sorted values.  The byteSize function makes a                    **  lot of matches happen, as everything is wrapped to a                    **  boundry, and this appears to be the reason.                    */#if defined(XP_WIN32) && defined(_MSC_VER)                    size1 = alloc1->mEvents[alloc1->mEventCount - 1].mHeapSize;                    size2 = alloc2->mEvents[alloc2->mEventCount - 1].mHeapSize;#else                    size1 = byteSize(alloc1);                    size2 = byteSize(alloc2);#endif                    if(size1 < size2)                    {                        retval = __LINE__;                    }                    else if(size1 > size2)                    {                        retval = - __LINE__;                    }                }                break;                case ST_TIMEVAL:                {                    PRUint32 timeval1 = (alloc1->mMaxTimeval - alloc1->mMinTimeval);                    PRUint32 timeval2 = (alloc2->mMaxTimeval - alloc2->mMinTimeval);                    if(timeval1 < timeval2)                    {                        retval = __LINE__;                    }                    else if(timeval1 > timeval2)                    {                        retval = - __LINE__;                    }                }                break;                default:                {                    REPORT_ERROR(__LINE__, compareAllocations);                }                break;            }        }    }    return retval;}