# Global Metrics

path: .metrics.cognitive.sum
old: 8.0
new: 66.0
path: .metrics.cognitive.average
old: 1.6
new: 22.0
path: .metrics.nexits.average
old: 1.0
new: 0.6666666666666666
path: .metrics.nexits.sum
old: 5.0
new: 2.0
path: .metrics.nargs.sum
old: 15.0
new: 10.0
path: .metrics.nargs.average
old: 3.0
new: 3.3333333333333335
path: .metrics.halstead.effort
old: 59211.08455507067
new: 227500.1333117191
path: .metrics.halstead.n2
old: 90.0
new: 52.0
path: .metrics.halstead.N1
old: 263.0
new: 407.0
path: .metrics.halstead.difficulty
old: 19.52777777777778
new: 57.0
path: .metrics.halstead.vocabulary
old: 109.0
new: 78.0
path: .metrics.halstead.N2
old: 185.0
new: 228.0
path: .metrics.halstead.volume
old: 3032.146577500063
new: 3991.230408977528
path: .metrics.halstead.estimated_program_length
old: 664.9774014250988
new: 418.63429801500513
path: .metrics.halstead.level
old: 0.051209103840682786
new: 0.017543859649122806
path: .metrics.halstead.length
old: 448.0
new: 635.0
path: .metrics.halstead.time
old: 3289.5046975039263
new: 12638.896295095508
path: .metrics.halstead.bugs
old: 0.5063849105864378
new: 1.2422238092011122
path: .metrics.halstead.n1
old: 19.0
new: 26.0
path: .metrics.halstead.purity_ratio
old: 1.4843245567524528
new: 0.6592666110472521
path: .metrics.cyclomatic.average
old: 1.3333333333333333
new: 8.75
path: .metrics.cyclomatic.sum
old: 32.0
new: 35.0
path: .metrics.nom.functions
old: 5.0
new: 3.0
path: .metrics.nom.total
old: 5.0
new: 3.0
path: .metrics.mi.mi_original
old: 41.78155411257234
new: 39.32137940214399
path: .metrics.mi.mi_visual_studio
old: 24.433657375773297
new: 22.994958714704087
path: .metrics.mi.mi_sei
old: 7.883606128090143
new: 9.279144391886536
path: .metrics.loc.sloc
old: 141.0
new: 144.0
path: .metrics.loc.cloc
old: 10.0
new: 16.0
path: .metrics.loc.ploc
old: 107.0
new: 120.0
path: .metrics.loc.lloc
old: 41.0
new: 80.0
path: .metrics.loc.blank
old: 24.0
new: 8.0

# Spaces Data

## Minimal test - lines (14, 18)

path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 5.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 5.0
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.mi.mi_visual_studio
old: null
new: 73.04422618803494
path: .spaces[0].metrics.mi.mi_original
old: null
new: 124.90562678153977
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 104.60169620424682
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 13.0
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 5.0
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 10.930842961666462
path: .spaces[0].metrics.halstead.level
old: null
new: 0.22857142857142856
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 44.97261104228487
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 4.375
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 7.0
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 4.0
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 2.127037265723325
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 11.0
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 196.7551733099963
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 8.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 27.651484454403228
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.01127620212709224
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.nargs.average
old: null
new: 2.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 2.0

### Code

    extern "C" uint32_t
    invoke_count_words(uint32_t paramCount, nsXPTCVariant* s)
    {
        return paramCount;
    }

## Minimal test - lines (140, 144)

path: .spaces[2].metrics.nargs.average
old: null
new: 4.0
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 4.0
path: .spaces[2].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[2].metrics.halstead.N2
old: 1.0
new: 12.0
path: .spaces[2].metrics.halstead.n1
old: 0.0
new: 7.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: null
new: 43.65148445440323
path: .spaces[2].metrics.halstead.n2
old: 1.0
new: 8.0
path: .spaces[2].metrics.halstead.purity_ratio
old: null
new: 1.616721646459379
path: .spaces[2].metrics.halstead.difficulty
old: 0.0
new: 5.25
path: .spaces[2].metrics.halstead.vocabulary
old: 1.0
new: 15.0
path: .spaces[2].metrics.halstead.bugs
old: 0.0
new: 0.022479239973047977
path: .spaces[2].metrics.halstead.effort
old: 0.0
new: 553.8017419275075
path: .spaces[2].metrics.halstead.length
old: 1.0
new: 27.0
path: .spaces[2].metrics.halstead.level
old: null
new: 0.1904761904761905
path: .spaces[2].metrics.halstead.N1
old: 0.0
new: 15.0
path: .spaces[2].metrics.halstead.time
old: 0.0
new: 30.76676344041708
path: .spaces[2].metrics.halstead.volume
old: 0.0
new: 105.48604608143
path: .spaces[2].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[2].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.ploc
old: 1.0
new: 5.0
path: .spaces[2].metrics.loc.sloc
old: 1.0
new: 5.0
path: .spaces[2].metrics.loc.lloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.nexits.average
old: null
new: 1.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.mi.mi_sei
old: null
new: 98.2060413983146
path: .spaces[2].metrics.mi.mi_original
old: null
new: 120.47249668497318
path: .spaces[2].metrics.mi.mi_visual_studio
old: null
new: 70.45175244735273

### Code

    NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                       uint32_t paramCount, nsXPTCVariant* params)
    {
        return _NS_InvokeByIndex(that, methodIndex, paramCount, params);
    }

## Minimal test - lines (20, 133)

path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 11.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 77.0
path: .spaces[1].metrics.loc.ploc
old: 1.0
new: 102.0
path: .spaces[1].metrics.loc.sloc
old: 1.0
new: 114.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[1].metrics.mi.mi_sei
old: null
new: 15.480162388261313
path: .spaces[1].metrics.mi.mi_original
old: null
new: 44.97226399063989
path: .spaces[1].metrics.mi.mi_visual_studio
old: null
new: 26.299569585169525
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 65.0
path: .spaces[1].metrics.cognitive.average
old: null
new: 65.0
path: .spaces[1].metrics.halstead.time
old: 0.0
new: 10796.191992871907
path: .spaces[1].metrics.halstead.purity_ratio
old: null
new: 0.540932567736484
path: .spaces[1].metrics.halstead.difficulty
old: 0.0
new: 58.4078947368421
path: .spaces[1].metrics.halstead.n1
old: 0.0
new: 23.0
path: .spaces[1].metrics.halstead.effort
old: 0.0
new: 194331.4558716943
path: .spaces[1].metrics.halstead.estimated_program_length
old: null
new: 303.4631705001675
path: .spaces[1].metrics.halstead.volume
old: 0.0
new: 3327.1436463727796
path: .spaces[1].metrics.halstead.N2
old: 1.0
new: 193.0
path: .spaces[1].metrics.halstead.vocabulary
old: 1.0
new: 61.0
path: .spaces[1].metrics.halstead.bugs
old: 0.0
new: 1.1183407452772651
path: .spaces[1].metrics.halstead.N1
old: 0.0
new: 368.0
path: .spaces[1].metrics.halstead.length
old: 1.0
new: 561.0
path: .spaces[1].metrics.halstead.level
old: null
new: 0.017120973192160396
path: .spaces[1].metrics.halstead.n2
old: 1.0
new: 38.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[1].metrics.nexits.average
old: null
new: 0.0
path: .spaces[1].metrics.nargs.average
old: null
new: 4.0
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 4.0
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 31.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 31.0

### Code

    extern "C" void
    invoke_copy_to_stack(uint64_t* d, uint32_t paramCount,
                         nsXPTCVariant* s, uint64_t *regs)
    {
    #define N_ARG_REGS       7       /* 8 regs minus 1 for "this" ptr */

        for (uint32_t i = 0; i < paramCount; i++, s++)
        {
            if (s->IsIndirect()) {
                if (i < N_ARG_REGS)
                    regs[i] = (uint64_t) &s->val;
                else
                    *d++ = (uint64_t) &s->val;
                continue;
            }
            switch (s->type) {
            //
            // signed types first
            //
            case nsXPTType::T_I8:
                if (i < N_ARG_REGS)
                    ((int64_t*)regs)[i] = s->val.i8;
                else
                    *d++ = s->val.i8;
                break;
            case nsXPTType::T_I16:
                if (i < N_ARG_REGS)
                    ((int64_t*)regs)[i] = s->val.i16;
                else
                    *d++ = s->val.i16;
                break;
            case nsXPTType::T_I32:
                if (i < N_ARG_REGS)
                    ((int64_t*)regs)[i] = s->val.i32;
                else
                    *d++ = s->val.i32;
                break;
            case nsXPTType::T_I64:
                if (i < N_ARG_REGS)
                    ((int64_t*)regs)[i] = s->val.i64;
                else
                    *d++ = s->val.i64;
                break;
            //
            // unsigned types next
            //
            case nsXPTType::T_U8:
                if (i < N_ARG_REGS)
                    regs[i] = s->val.u8;
                else
                    *d++ = s->val.u8;
                break;
            case nsXPTType::T_U16:
                if (i < N_ARG_REGS)
                    regs[i] = s->val.u16;
                else
                    *d++ = s->val.u16;
                break;
            case nsXPTType::T_U32:
                if (i < N_ARG_REGS)
    		// 32-bit values need to be sign-extended
    		// in register, so use the signed value.
                    regs[i] = s->val.i32;
                else
                    *d++ = s->val.u32;
                break;
            case nsXPTType::T_U64:
                if (i < N_ARG_REGS)
                    regs[i] = s->val.u64;
                else
                    *d++ = s->val.u64;
                break;
            case nsXPTType::T_FLOAT:
                // the float data formate must not be converted!
                // Just only copy without conversion.
                if (i < N_ARG_REGS)
                    *(float*)®s[i] = s->val.f;
                else
                    *(float*)d++ = s->val.f;
                break;
            case nsXPTType::T_DOUBLE:
                if (i < N_ARG_REGS)
                    *(double*)®s[i] = s->val.d;
                else
                    *(double*)d++ = s->val.d;
                break;
            case nsXPTType::T_BOOL:
                if (i < N_ARG_REGS)
                    regs[i] = s->val.b;
                else
                    *d++ = s->val.b;
                break;
            case nsXPTType::T_CHAR:
                if (i < N_ARG_REGS)
                    regs[i] = s->val.c;
                else
                    *d++ = s->val.c;
                break;
            case nsXPTType::T_WCHAR:
                if (i < N_ARG_REGS)
                    regs[i] = s->val.wc;
                else
                    *d++ = s->val.wc;
                break;
            default:
                // all the others are plain pointer types
                if (i < N_ARG_REGS)
                    regs[i] = (uint64_t)s->val.p;
                else
                   *d++ = (uint64_t)s->val.p;
                break;
            }
        }
    }