in Legacy/PlaygroundLogger/PlaygroundLogger/PlaygroundObjectWriter.swift [63:84]
func encode(structure: LoggerMirror, depth: UInt64, capping_policy: NestedDataCappingPolicy) {
let mirror_count : UInt64 = UInt64(structure.count)
switch (capping_policy)
{
case .All:
encode(structure: structure, depth: depth, ranges: 0..<mirror_count)
case .Head(let count):
encode(structure: structure, depth: depth, ranges: 0..<count)
case .HeadTail(let count, let percentage):
if UInt64(structure.count) <= count {
encode(structure: structure, depth: depth, ranges: 0..<mirror_count)
} else {
let head_count = (count * UInt64(percentage) / 100)
let tail_count = count - head_count
let head_range = 0..<head_count
let tail_range = (mirror_count-tail_count)..<mirror_count
encode(structure: structure, depth: depth, ranges: head_range, tail_range)
}
case .None:
encode(structure: structure, depth: depth, ranges: 0..<0)
}
}