# Global Metrics

path: .metrics.mi.mi_original
old: 67.1370733650729
new: 55.04696490704053
path: .metrics.mi.mi_visual_studio
old: 39.26144641232333
new: 32.191207547976916
path: .metrics.mi.mi_sei
old: 62.73915287057048
new: 35.19743394722814
path: .metrics.nom.functions
old: 2.0
new: 1.0
path: .metrics.nom.total
old: 2.0
new: 1.0
path: .metrics.loc.blank
old: 9.0
new: 7.0
path: .metrics.loc.cloc
old: 25.0
new: 12.0
path: .metrics.loc.sloc
old: 67.0
new: 75.0
path: .metrics.loc.ploc
old: 33.0
new: 56.0
path: .metrics.loc.lloc
old: 9.0
new: 57.0
path: .metrics.cyclomatic.sum
old: 10.0
new: 24.0
path: .metrics.cyclomatic.average
old: 2.0
new: 12.0
path: .metrics.nexits.sum
old: 4.0
new: 0.0
path: .metrics.nexits.average
old: 2.0
new: 0.0
path: .metrics.cognitive.average
old: 2.0
new: 25.0
path: .metrics.cognitive.sum
old: 4.0
new: 25.0
path: .metrics.nargs.sum
old: 1.0
new: 5.0
path: .metrics.nargs.average
old: 0.5
new: 5.0
path: .metrics.halstead.time
old: 670.9116260328556
new: 4667.980251102139
path: .metrics.halstead.vocabulary
old: 41.0
new: 73.0
path: .metrics.halstead.bugs
old: 0.17545697079960015
new: 0.6394595661474614
path: .metrics.halstead.length
old: 116.0
new: 389.0
path: .metrics.halstead.N2
old: 45.0
new: 134.0
path: .metrics.halstead.volume
old: 621.4760325356978
new: 2407.841753404327
path: .metrics.halstead.n1
old: 19.0
new: 25.0
path: .metrics.halstead.purity_ratio
old: 1.5415355031504192
new: 0.9875953850359476
path: .metrics.halstead.effort
old: 12076.4092685914
new: 84023.6445198385
path: .metrics.halstead.N1
old: 71.0
new: 255.0
path: .metrics.halstead.difficulty
old: 19.431818181818183
new: 34.895833333333336
path: .metrics.halstead.estimated_program_length
old: 178.81811836544864
new: 384.1746047789836
path: .metrics.halstead.n2
old: 22.0
new: 48.0
path: .metrics.halstead.level
old: 0.05146198830409356
new: 0.028656716417910445

# Spaces Data

## Minimal test - lines (18, 75)

path: .spaces[0].metrics.halstead.bugs
old: 0.1642499402902525
new: 0.6380314122018734
path: .spaces[0].metrics.halstead.length
old: 106.0
new: 377.0
path: .spaces[0].metrics.halstead.N2
old: 38.0
new: 128.0
path: .spaces[0].metrics.halstead.level
old: 0.04970760233918129
new: 0.027499999999999997
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.3636369653511076
new: 0.945123066218592
path: .spaces[0].metrics.halstead.vocabulary
old: 35.0
new: 69.0
path: .spaces[0].metrics.halstead.n1
old: 18.0
new: 25.0
path: .spaces[0].metrics.halstead.n2
old: 17.0
new: 44.0
path: .spaces[0].metrics.halstead.time
old: 607.6691762427741
new: 4652.350949909839
path: .spaces[0].metrics.halstead.volume
old: 543.7039997961664
new: 2302.91372020537
path: .spaces[0].metrics.halstead.effort
old: 10938.045172369935
new: 83742.3170983771
path: .spaces[0].metrics.halstead.N1
old: 68.0
new: 249.0
path: .spaces[0].metrics.halstead.difficulty
old: 20.11764705882353
new: 36.36363636363637
path: .spaces[0].metrics.halstead.estimated_program_length
old: 144.5455183272174
new: 356.3113959644092
path: .spaces[0].metrics.cyclomatic.average
old: 2.0
new: 23.0
path: .spaces[0].metrics.cyclomatic.sum
old: 8.0
new: 23.0
path: .spaces[0].metrics.nargs.average
old: 0.5
new: 5.0
path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 5.0
path: .spaces[0].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[0].metrics.nexits.sum
old: 4.0
new: 0.0
path: .spaces[0].metrics.mi.mi_original
old: 77.47939831254158
new: 59.672784966987294
path: .spaces[0].metrics.mi.mi_sei
old: 71.11855832157522
new: 29.98501641605572
path: .spaces[0].metrics.mi.mi_visual_studio
old: 45.309589656457064
new: 34.896365477770345
path: .spaces[0].metrics.cognitive.average
old: 1.5
new: 25.0
path: .spaces[0].metrics.cognitive.sum
old: 3.0
new: 25.0
path: .spaces[0].metrics.nom.functions
old: 2.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[0].metrics.loc.sloc
old: 38.0
new: 58.0
path: .spaces[0].metrics.loc.cloc
old: 9.0
new: 3.0
path: .spaces[0].metrics.loc.ploc
old: 24.0
new: 53.0
path: .spaces[0].metrics.loc.blank
old: 5.0
new: 2.0
path: .spaces[0].metrics.loc.lloc
old: 9.0
new: 57.0

### Code

    extern "C" void
    InvokeCopyToStack(uint64_t * gpregs, double * fpregs,
                         uint32_t paramCount, nsXPTCVariant * s,
                         uint64_t* d)
    {
        uint32_t nr_gpr = 0u;
        uint32_t nr_fpr = 0u;
        uint64_t value = 0u;

        for (uint32_t i = 0; i < paramCount; i++, s++) {
            if (s->IsIndirect())
                value = (uint64_t) &s->val;
            else {
                switch (s->type) {
                case nsXPTType::T_FLOAT:                                break;
                case nsXPTType::T_DOUBLE:                               break;
                case nsXPTType::T_I8:     value = s->val.i8;            break;
                case nsXPTType::T_I16:    value = s->val.i16;           break;
                case nsXPTType::T_I32:    value = s->val.i32;           break;
                case nsXPTType::T_I64:    value = s->val.i64;           break;
                case nsXPTType::T_U8:     value = s->val.u8;            break;
                case nsXPTType::T_U16:    value = s->val.u16;           break;
                case nsXPTType::T_U32:    value = s->val.u32;           break;
                case nsXPTType::T_U64:    value = s->val.u64;           break;
                case nsXPTType::T_BOOL:   value = s->val.b;             break;
                case nsXPTType::T_CHAR:   value = s->val.c;             break;
                case nsXPTType::T_WCHAR:  value = s->val.wc;            break;
                default:                  value = (uint64_t) s->val.p;  break;
                }
            }

            if (!s->IsIndirect() && s->type == nsXPTType::T_DOUBLE) {
                if (nr_fpr < FPR_COUNT)
                    fpregs[nr_fpr++] = s->val.d;
                else {
                    *((double *)d) = s->val.d;
                    d++;
                }
            }
            else if (!s->IsIndirect() && s->type == nsXPTType::T_FLOAT) {
                if (nr_fpr < FPR_COUNT)
                    // The value in %xmm register is already prepared to
                    // be retrieved as a float. Therefore, we pass the
                    // value verbatim, as a double without conversion.
                    fpregs[nr_fpr++] = s->val.d;
                else {
                    *((float *)d) = s->val.f;
                    d++;
                }
            }
            else {
                if (nr_gpr < GPR_COUNT)
                    gpregs[nr_gpr++] = value;
                else
                    *d++ = value;
            }
        }
    }