MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / insert

Method insert

src/core/impl/graph/swap/memory_swap.cpp:53–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 void insert(int k, int l, int r, int ll, int rr, PLI info) {
54 if (l == ll && rr == r) {
55 m_tree[k].max += info.first;
56 m_lzt[k] += info.first;
57 if (info.second > -1) {
58 if (m_seg_info.find(k) == m_seg_info.end()) {
59 ThinHashSet<int> tmp;
60 m_seg_info[k] = tmp;
61 }
62 m_seg_info[k].insert(info.second);
63 }
64 return;
65 }
66 int mid = (l + r) >> 1;
67 if (rr <= mid)
68 insert(k << 1, l, mid, ll, rr, info);
69 else if (ll > mid)
70 insert(k << 1 | 1, mid + 1, r, ll, rr, info);
71 else {
72 insert(k << 1, l, mid, ll, mid, info);
73 insert(k << 1 | 1, mid + 1, r, mid + 1, rr, info);
74 }
75 if (m_tree[k << 1] <= m_tree[k << 1 | 1]) {
76 m_tree[k].max = m_tree[k << 1 | 1].max + m_lzt[k];
77 m_tree[k].idx = m_tree[k << 1 | 1].idx;
78 } else {
79 m_tree[k].max = m_tree[k << 1].max + m_lzt[k];
80 m_tree[k].idx = m_tree[k << 1].idx;
81 }
82 }
83
84 void remove(int k, int l, int r, int ll, int rr, PLI info) {
85 if (l == ll && rr == r) {

Callers 15

addMethod · 0.45
test_hash_mapFunction · 0.45
TESTFunction · 0.45
run_multi_keyFunction · 0.45
alloc_dynamicMethod · 0.45
alloc_dynamicMethod · 0.45
TESTFunction · 0.45
insert_free_unsafeMethod · 0.45
dump_cacheMethod · 0.45
dump_infoMethod · 0.45
update_out_specsMethod · 0.45
concat_and_prepareMethod · 0.45

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by 7

addMethod · 0.36
test_hash_mapFunction · 0.36
TESTFunction · 0.36
run_multi_keyFunction · 0.36
alloc_dynamicMethod · 0.36
alloc_dynamicMethod · 0.36
TESTFunction · 0.36