# Global Metrics

path: .metrics.loc.lloc
old: 53.0
new: 52.0

# Spaces Data

## Minimal test - lines (13, 60)

path: .spaces[0].metrics.halstead.length
old: 336.0
new: 340.0
path: .spaces[0].metrics.halstead.n2
old: 41.0
new: 42.0
path: .spaces[0].metrics.halstead.time
old: 3113.2395204804766
new: 3116.6666666666665
path: .spaces[0].metrics.halstead.N2
old: 104.0
new: 105.0
path: .spaces[0].metrics.halstead.difficulty
old: 27.902439024390244
new: 27.5
path: .spaces[0].metrics.halstead.estimated_program_length
old: 317.76712779936196
new: 324.58482736672846
path: .spaces[0].metrics.halstead.level
old: 0.03583916083916084
new: 0.03636363636363636
path: .spaces[0].metrics.halstead.effort
old: 56038.31136864858
new: 56100.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.945735499402863
new: 0.954661256960966
path: .spaces[0].metrics.halstead.bugs
old: 0.4881299312250236
new: 0.4884880974466169
path: .spaces[0].metrics.halstead.volume
old: 2008.366054295972
new: 2040.0
path: .spaces[0].metrics.halstead.vocabulary
old: 63.0
new: 64.0
path: .spaces[0].metrics.halstead.N1
old: 232.0
new: 235.0
path: .spaces[0].metrics.mi.mi_original
old: 65.51961021367832
new: 64.7488771717332
path: .spaces[0].metrics.mi.mi_visual_studio
old: 38.31556152846685
new: 37.864840451305966
path: .spaces[0].metrics.mi.mi_sei
old: 44.99665666778169
new: 43.41424654686138
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 41.0
new: 42.0
path: .spaces[0].metrics.loc.sloc
old: 46.0
new: 48.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;
            }
        }
    }