# Global Metrics

path: .metrics.halstead.time
old: 2664.202676644462
new: 1748.8656098401073
path: .metrics.halstead.estimated_program_length
old: 782.6464364849548
new: 233.1201147370535
path: .metrics.halstead.difficulty
old: 15.316037735849056
new: 28.603448275862068
path: .metrics.halstead.level
old: 0.06529103788112103
new: 0.03496081977094635
path: .metrics.halstead.effort
old: 47955.64817960031
new: 31479.580977121932
path: .metrics.halstead.N1
old: 260.0
new: 116.0
path: .metrics.halstead.N2
old: 191.0
new: 79.0
path: .metrics.halstead.bugs
old: 0.439985727544747
new: 0.3323262960800464
path: .metrics.halstead.n2
old: 106.0
new: 29.0
path: .metrics.halstead.purity_ratio
old: 1.7353579522948002
new: 1.195487767882326
path: .metrics.halstead.vocabulary
old: 123.0
new: 50.0
path: .metrics.halstead.volume
old: 3131.074041907997
new: 1100.5519570060712
path: .metrics.halstead.length
old: 451.0
new: 195.0
path: .metrics.halstead.n1
old: 17.0
new: 21.0
path: .metrics.loc.cloc
old: 23.0
new: 13.0
path: .metrics.loc.sloc
old: 147.0
new: 51.0
path: .metrics.loc.blank
old: 28.0
new: 3.0
path: .metrics.loc.lloc
old: 4.0
new: 12.0
path: .metrics.loc.ploc
old: 96.0
new: 35.0
path: .metrics.nexits.average
old: 0.6666666666666666
new: 1.0
path: .metrics.nexits.sum
old: 2.0
new: 1.0
path: .metrics.mi.mi_original
old: 44.38950897510793
new: 68.35587576728986
path: .metrics.mi.mi_visual_studio
old: 25.958777178425688
new: 39.97419635514027
path: .metrics.mi.mi_sei
old: 18.82816630096289
new: 59.276300218411265
path: .metrics.nargs.average
old: 0.3333333333333333
new: 6.0
path: .metrics.nargs.sum
old: 1.0
new: 6.0
path: .metrics.cyclomatic.average
old: 1.3076923076923077
new: 3.6666666666666665
path: .metrics.cyclomatic.sum
old: 17.0
new: 11.0
path: .metrics.nom.functions
old: 3.0
new: 1.0
path: .metrics.nom.total
old: 3.0
new: 1.0
path: .metrics.cognitive.average
old: 0.0
new: 6.0
path: .metrics.cognitive.sum
old: 0.0
new: 6.0

# Spaces Data

## Minimal test - lines (16, 51)

path: .spaces[0].metrics.halstead.level
old: null
new: 0.03258145363408521
path: .spaces[0].metrics.halstead.vocabulary
old: 1.0
new: 47.0
path: .spaces[0].metrics.halstead.length
old: 1.0
new: 192.0
path: .spaces[0].metrics.halstead.N2
old: 1.0
new: 76.0
path: .spaces[0].metrics.halstead.N1
old: 0.0
new: 116.0
path: .spaces[0].metrics.halstead.n2
old: 1.0
new: 26.0
path: .spaces[0].metrics.halstead.n1
old: 0.0
new: 21.0
path: .spaces[0].metrics.halstead.effort
old: 0.0
new: 32732.76482687081
path: .spaces[0].metrics.halstead.time
old: 0.0
new: 1818.486934826156
path: .spaces[0].metrics.halstead.bugs
old: 0.0
new: 0.3410886007581034
path: .spaces[0].metrics.halstead.volume
old: 0.0
new: 1066.4810595221063
path: .spaces[0].metrics.halstead.difficulty
old: 0.0
new: 30.692307692307693
path: .spaces[0].metrics.halstead.estimated_program_length
old: null
new: 214.45009855002235
path: .spaces[0].metrics.halstead.purity_ratio
old: null
new: 1.1169275966146996
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 6.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 6.0
path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 12.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 31.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 36.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.cyclomatic.average
old: 1.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 10.0
path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 6.0
path: .spaces[0].metrics.nargs.average
old: null
new: 6.0
path: .spaces[0].metrics.mi.mi_sei
old: null
new: 54.26501525555858
path: .spaces[0].metrics.mi.mi_visual_studio
old: null
new: 43.50407622804155
path: .spaces[0].metrics.mi.mi_original
old: null
new: 74.39197034995105
path: .spaces[0].metrics.nexits.average
old: null
new: 1.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0

### Code

    namespace fuzzer {

    // Cross Data1 and Data2, store the result (up to MaxOutSize bytes) in Out.
    size_t MutationDispatcher::CrossOver(const uint8_t *Data1, size_t Size1,
                                         const uint8_t *Data2, size_t Size2,
                                         uint8_t *Out, size_t MaxOutSize) {
      assert(Size1 || Size2);
      MaxOutSize = Rand(MaxOutSize) + 1;
      size_t OutPos = 0;
      size_t Pos1 = 0;
      size_t Pos2 = 0;
      size_t *InPos = &Pos1;
      size_t InSize = Size1;
      const uint8_t *Data = Data1;
      bool CurrentlyUsingFirstData = true;
      while (OutPos < MaxOutSize && (Pos1 < Size1 || Pos2 < Size2)) {
        // Merge a part of Data into Out.
        size_t OutSizeLeft = MaxOutSize - OutPos;
        if (*InPos < InSize) {
          size_t InSizeLeft = InSize - *InPos;
          size_t MaxExtraSize = std::min(OutSizeLeft, InSizeLeft);
          size_t ExtraSize = Rand(MaxExtraSize) + 1;
          memcpy(Out + OutPos, Data + *InPos, ExtraSize);
          OutPos += ExtraSize;
          (*InPos) += ExtraSize;
        }
        // Use the other input data on the next iteration.
        InPos  = CurrentlyUsingFirstData ? &Pos2 : &Pos1;
        InSize = CurrentlyUsingFirstData ? Size2 : Size1;
        Data   = CurrentlyUsingFirstData ? Data2 : Data1;
        CurrentlyUsingFirstData = !CurrentlyUsingFirstData;
      }
      return OutPos;
    }

    }  // namespace fuzzer