# Global Metrics

path: .metrics.cyclomatic.average
old: 2.382978723404255
new: 9.0
path: .metrics.cyclomatic.sum
old: 112.0
new: 18.0
path: .metrics.cognitive.sum
old: 103.0
new: 9.0
path: .metrics.cognitive.average
old: 2.861111111111111
new: 9.0
path: .metrics.nexits.sum
old: 30.0
new: 0.0
path: .metrics.nexits.average
old: 0.8333333333333334
new: 0.0
path: .metrics.halstead.N1
old: 1569.0
new: 248.0
path: .metrics.halstead.N2
old: 957.0
new: 167.0
path: .metrics.halstead.purity_ratio
old: 0.42630788682438187
new: 1.798431470682677
path: .metrics.halstead.n1
old: 39.0
new: 22.0
path: .metrics.halstead.volume
old: 18585.17636366528
new: 2866.3595971775353
path: .metrics.halstead.bugs
old: 6.581843634248551
new: 0.474629340081596
path: .metrics.halstead.length
old: 2526.0
new: 415.0
path: .metrics.halstead.effort
old: 2774618.149684317
new: 53729.61816341972
path: .metrics.halstead.estimated_program_length
old: 1076.8537221183883
new: 746.349060333311
path: .metrics.halstead.level
old: 0.0066982825603515254
new: 0.05334784975503538
path: .metrics.halstead.difficulty
old: 149.292
new: 18.744897959183675
path: .metrics.halstead.vocabulary
old: 164.0
new: 120.0
path: .metrics.halstead.time
old: 154145.45276023983
new: 2984.978786856651
path: .metrics.halstead.n2
old: 125.0
new: 98.0
path: .metrics.loc.ploc
old: 579.0
new: 100.0
path: .metrics.loc.sloc
old: 747.0
new: 144.0
path: .metrics.loc.blank
old: 99.0
new: 0.0
path: .metrics.loc.lloc
old: 215.0
new: 52.0
path: .metrics.loc.cloc
old: 69.0
new: 49.0
path: .metrics.nom.functions
old: 36.0
new: 1.0
path: .metrics.nom.total
old: 36.0
new: 1.0
path: .metrics.nargs.average
old: 0.3611111111111111
new: 3.0
path: .metrics.nargs.sum
old: 13.0
new: 3.0
path: .metrics.mi.mi_original
old: -13.05687777488646
new: 44.95287457989245
path: .metrics.mi.mi_visual_studio
old: 0.0
new: 26.28823074847512
path: .metrics.mi.mi_sei
old: -60.45253680117733
new: 30.266149465583773

# Spaces Data

## Minimal test - lines (13, 60)

path: .spaces[0].metrics.cyclomatic.average
old: 2.4130434782608696
new: 17.0
path: .spaces[0].metrics.cyclomatic.sum
old: 111.0
new: 17.0
path: .spaces[0].metrics.nargs.sum
old: 13.0
new: 3.0
path: .spaces[0].metrics.nargs.average
old: 0.3611111111111111
new: 3.0
path: .spaces[0].metrics.nom.functions
old: 36.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 36.0
new: 1.0
path: .spaces[0].metrics.loc.lloc
old: 215.0
new: 50.0
path: .spaces[0].metrics.loc.blank
old: 94.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 555.0
new: 42.0
path: .spaces[0].metrics.loc.sloc
old: 696.0
new: 48.0
path: .spaces[0].metrics.loc.cloc
old: 47.0
new: 5.0
path: .spaces[0].metrics.mi.mi_sei
old: -61.616760855559576
new: 43.41424654686138
path: .spaces[0].metrics.mi.mi_visual_studio
old: 0.0
new: 37.864840451305966
path: .spaces[0].metrics.mi.mi_original
old: -11.650061323634134
new: 64.7488771717332
path: .spaces[0].metrics.nexits.sum
old: 30.0
new: 0.0
path: .spaces[0].metrics.nexits.average
old: 0.8333333333333334
new: 0.0
path: .spaces[0].metrics.halstead.vocabulary
old: 161.0
new: 64.0
path: .spaces[0].metrics.halstead.level
old: 0.006578769985710048
new: 0.03636363636363636
path: .spaces[0].metrics.halstead.difficulty
old: 152.00409836065575
new: 27.5
path: .spaces[0].metrics.halstead.bugs
old: 6.634703220887475
new: 0.4884880974466169
path: .spaces[0].metrics.halstead.time
old: 156006.11743006157
new: 3116.6666666666665
path: .spaces[0].metrics.halstead.effort
old: 2808110.113741108
new: 56100.0
path: .spaces[0].metrics.halstead.N1
old: 1569.0
new: 235.0
path: .spaces[0].metrics.halstead.length
old: 2520.0
new: 340.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 1051.6806417183
new: 324.58482736672846
path: .spaces[0].metrics.halstead.n2
old: 122.0
new: 42.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.4173335879834524
new: 0.954661256960966
path: .spaces[0].metrics.halstead.N2
old: 951.0
new: 105.0
path: .spaces[0].metrics.halstead.volume
old: 18473.910532848833
new: 2040.0
path: .spaces[0].metrics.halstead.n1
old: 39.0
new: 22.0
path: .spaces[0].metrics.cognitive.average
old: 2.861111111111111
new: 9.0
path: .spaces[0].metrics.cognitive.sum
old: 103.0
new: 9.0

### Code

    __asm__("invoke_copy_to_stack") __attribute__((used));

    static void
    invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s)
    {
        const uint8_t NUM_ARG_REGS = 6-1;        // -1 for "this" pointer

        for(uint32_t i = 0; i < paramCount; i++, d++, s++)
        {
            if(s->IsPtrData())
            {
                *d = (uint64_t)s->ptr;
                continue;
            }
            switch(s->type)
            {
            case nsXPTType::T_I8     : *d = (uint64_t)s->val.i8;     break;
            case nsXPTType::T_I16    : *d = (uint64_t)s->val.i16;    break;
            case nsXPTType::T_I32    : *d = (uint64_t)s->val.i32;    break;
            case nsXPTType::T_I64    : *d = (uint64_t)s->val.i64;    break;
            case nsXPTType::T_U8     : *d = (uint64_t)s->val.u8;     break;
            case nsXPTType::T_U16    : *d = (uint64_t)s->val.u16;    break;
            case nsXPTType::T_U32    : *d = (uint64_t)s->val.u32;    break;
            case nsXPTType::T_U64    : *d = (uint64_t)s->val.u64;    break;
            case nsXPTType::T_FLOAT  :
                if(i < NUM_ARG_REGS)
                {
                    // convert floats to doubles if they are to be passed
                    // via registers so we can just deal with doubles later
                    union { uint64_t u64; double d; } t;
                    t.d = (double)s->val.f;
                    *d = t.u64;
                }
                else
                    // otherwise copy to stack normally
                    *d = (uint64_t)s->val.u32;
                break;
            case nsXPTType::T_DOUBLE : *d = (uint64_t)s->val.u64;    break;
            case nsXPTType::T_BOOL   : *d = (uint64_t)s->val.b;      break;
            case nsXPTType::T_CHAR   : *d = (uint64_t)s->val.c;      break;
            case nsXPTType::T_WCHAR  : *d = (uint64_t)s->val.wc;     break;
            default:
                // all the others are plain pointer types
                *d = (uint64_t)s->val.p;
                break;
            }
        }
    }