# Global Metrics

path: .metrics.nexits.average
old: 3.2666666666666666
new: 1.0
path: .metrics.nexits.sum
old: 49.0
new: 1.0
path: .metrics.nom.functions
old: 15.0
new: 1.0
path: .metrics.nom.total
old: 15.0
new: 1.0
path: .metrics.cognitive.average
old: 8.933333333333334
new: 17.0
path: .metrics.cognitive.sum
old: 134.0
new: 17.0
path: .metrics.halstead.time
old: 40275.67470007791
new: 5291.316340076144
path: .metrics.halstead.estimated_program_length
old: 2195.2785944576135
new: 574.0686254699096
path: .metrics.halstead.level
old: 0.02277843994172957
new: 0.033827618164967564
path: .metrics.halstead.N1
old: 1186.0
new: 320.0
path: .metrics.halstead.n2
old: 258.0
new: 73.0
path: .metrics.halstead.effort
old: 724962.1446014023
new: 95243.6941213706
path: .metrics.halstead.bugs
old: 2.6900207601276875
new: 0.6951890128764175
path: .metrics.halstead.volume
old: 16513.506670830513
new: 3221.8673173586903
path: .metrics.halstead.purity_ratio
old: 1.0840881947938832
new: 1.1812111635183329
path: .metrics.halstead.N2
old: 839.0
new: 166.0
path: .metrics.halstead.length
old: 2025.0
new: 486.0
path: .metrics.halstead.vocabulary
old: 285.0
new: 99.0
path: .metrics.halstead.difficulty
old: 43.90116279069768
new: 29.561643835616437
path: .metrics.halstead.n1
old: 27.0
new: 26.0
path: .metrics.nargs.sum
old: 16.0
new: 3.0
path: .metrics.nargs.average
old: 1.0666666666666669
new: 3.0
path: .metrics.mi.mi_original
old: -7.046688756809772
new: 48.69674224398656
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 28.477627043266995
path: .metrics.mi.mi_sei
old: -48.69935293403901
new: 22.830948433368953
path: .metrics.loc.cloc
old: 75.0
new: 13.0
path: .metrics.loc.blank
old: 82.0
new: 20.0
path: .metrics.loc.ploc
old: 426.0
new: 71.0
path: .metrics.loc.lloc
old: 189.0
new: 67.0
path: .metrics.loc.sloc
old: 583.0
new: 104.0
path: .metrics.cyclomatic.average
old: 5.3
new: 11.0
path: .metrics.cyclomatic.sum
old: 106.0
new: 22.0

# Spaces Data

## Minimal test - lines (18, 93)

path: .spaces[0].metrics.mi.mi_original
old: 104.57409952584013
new: 54.22165501152334
path: .spaces[0].metrics.mi.mi_sei
old: 75.37132251815463
new: 13.50122041370746
path: .spaces[0].metrics.mi.mi_visual_studio
old: 61.15444416715796
new: 31.70857018217739
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 17.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 17.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 67.0
path: .spaces[0].metrics.loc.sloc
old: 13.0
new: 76.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.blank
old: 3.0
new: 11.0
path: .spaces[0].metrics.loc.ploc
old: 10.0
new: 64.0
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.halstead.effort
old: 430.73468816583915
new: 95622.96420297062
path: .spaces[0].metrics.halstead.vocabulary
old: 15.0
new: 92.0
path: .spaces[0].metrics.halstead.bugs
old: 0.01901159893633345
new: 0.6970333324422384
path: .spaces[0].metrics.halstead.length
old: 28.0
new: 474.0
path: .spaces[0].metrics.halstead.volume
old: 109.39293667703852
new: 3092.1683671710243
path: .spaces[0].metrics.halstead.difficulty
old: 3.9375
new: 30.924242424242426
path: .spaces[0].metrics.halstead.time
old: 23.929704898102173
new: 5312.386900165035
path: .spaces[0].metrics.halstead.N1
old: 19.0
new: 317.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.5589815876572584
new: 1.0994545243656677
path: .spaces[0].metrics.halstead.N2
old: 9.0
new: 157.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 43.65148445440323
new: 521.1414445493264
path: .spaces[0].metrics.halstead.n2
old: 8.0
new: 66.0
path: .spaces[0].metrics.halstead.level
old: 0.25396825396825395
new: 0.03233708966193043
path: .spaces[0].metrics.halstead.n1
old: 7.0
new: 26.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[0].metrics.nargs.average
old: null
new: 3.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 21.0
path: .spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 21.0

### Code

    PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args)
    {
        args++; // always skip over a0

        nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
        const nsXPTMethodInfo* info;
        uint8_t paramCount;
        uint8_t i;

        NS_ASSERTION(self,"no self");

        self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
        NS_ASSERTION(info,"no method info");

        paramCount = info->GetParamCount();

        const uint8_t indexOfJSContext = info->IndexOfJSContext();

        uint32_t* ap = args;
        for(i = 0; i < paramCount; i++, ap++)
        {
            const nsXPTParamInfo& param = info->GetParam(i);
            const nsXPTType& type = param.GetType();
            nsXPTCMiniVariant* dp = ¶mBuffer[i];

            if (i == indexOfJSContext)
                ap++;

            if(param.IsOut() || !type.IsArithmetic())
            {
                dp->val.p = (void*) *ap;
                continue;
            }

            switch(type)
            {
            case nsXPTType::T_I64   :
                if ((intptr_t)ap & 4) ap++;
                dp->val.i64 = *((int64_t*) ap); ap++;
                break;
            case nsXPTType::T_U64   :
                if ((intptr_t)ap & 4) ap++;
                dp->val.u64 = *((int64_t*) ap); ap++;
                break;
            case nsXPTType::T_DOUBLE:
                if ((intptr_t)ap & 4) ap++;
                dp->val.d   = *((double*) ap);  ap++;
                break;
    #ifdef IS_LITTLE_ENDIAN
            default:
                dp->val.p = (void*) *ap;
                break;
    #else
            case nsXPTType::T_I8    : dp->val.i8  = (int8_t)   *ap; break;
            case nsXPTType::T_I16   : dp->val.i16 = (int16_t)  *ap; break;
            case nsXPTType::T_I32   : dp->val.i32 = (int32_t)  *ap; break;
            case nsXPTType::T_U8    : dp->val.u8  = (uint8_t)  *ap; break;
            case nsXPTType::T_U16   : dp->val.u16 = (uint16_t) *ap; break;
            case nsXPTType::T_U32   : dp->val.u32 = (uint32_t) *ap; break;
            case nsXPTType::T_BOOL  : dp->val.b   = (bool)   *ap; break;
            case nsXPTType::T_CHAR  : dp->val.c   = (char)     *ap; break;
            case nsXPTType::T_WCHAR : dp->val.wc  = (wchar_t)  *ap; break;
            case nsXPTType::T_FLOAT : dp->val.f   = *(float *)  ap; break;
            default:
                NS_ASSERTION(0, "bad type");
                break;
    #endif
            }
        }

        nsresult result = self->mOuter->CallMethod((uint16_t)methodIndex, info,
                                                   paramBuffer);

        return result;
    }