MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / split

Method split

genericrange.h:58–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 bool overlaps(const GenericRange& other) const { return !(other.m_start > m_end || m_start > other.m_end); }
57
58 vector<GenericRange> split(const GenericRange& nextInterval) const
59 {
60 vector<GenericRange> result;
61 if (overlaps(nextInterval))
62 {
63 // Find overlap start and end
64 uint64_t intersectionStart = std::max(m_start, nextInterval.m_start);
65 uint64_t intersectionEnd = std::min(m_end, nextInterval.m_end);
66
67 // Add part of this section to before the intersecting region if it starts earlier
68 if (m_start < intersectionStart)
69 result.push_back({m_start, intersectionStart - 1, m_items});
70
71 // Add the intersecting range, plus both sets of items
72 GenericRange intersection(intersectionStart, intersectionEnd, m_items);
73 intersection.m_items.insert(intersection.m_items.end(), nextInterval.m_items.begin(), nextInterval.m_items.end());
74 result.push_back(intersection);
75
76 // If the an interval's end is after the intersection (only up to one will be) add it after
77 if (nextInterval.m_end > intersectionEnd)
78 result.push_back({intersectionEnd + 1, nextInterval.m_end, nextInterval.m_items});
79 else if (m_end > intersectionEnd)
80 result.push_back({intersectionEnd + 1, m_end, m_items});
81 }
82
83 return result;
84 }
85 };
86
87 // A map of ranges to items. The ranges are flattened and sorted, and the map is used to quickly find the items. Range values are inclusive.

Callers 15

flattenMethod · 0.45
mainFunction · 0.45
__init__Method · 0.45
genCheckMatchMethod · 0.45
genCheckUnpredictableMethod · 0.45
genExtractGeneralMethod · 0.45
genEncodingBlockFunction · 0.45
addMethod · 0.45
gen_nodeFunction · 0.45
applyIndentFunction · 0.45
genMethod · 0.45
genBlockFunction · 0.45

Calls 4

push_backMethod · 0.80
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by 3

mainFunction · 0.36
print_caseFunction · 0.36
compare_disassemblyFunction · 0.36