llvm.org GIT mirror llvm / 2559cde
PBQP: Minor cleanups to r204857 * Use assignment instead of swap (since the original value is being destroyed anyway) * Rename "updateAdjEdgeId" to "setAdjEdgeId" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204983 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 6 years ago
1 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
6969 void removeAdjEdgeId(Graph &G, NodeId ThisNId, AdjEdgeIdx Idx) {
7070 // Swap-and-pop for fast removal.
7171 // 1) Update the adj index of the edge currently at back().
72 // 2) Swap Edge at Idx with back().
72 // 2) Move last Edge down to Idx.
7373 // 3) pop_back()
74 // If Idx == size() - 1 then the updateAdjEdgeIdx and swap are
74 // If Idx == size() - 1 then the setAdjEdgeIdx and swap are
7575 // redundant, but both operations are cheap.
76 G.getEdge(AdjEdgeIds.back()).updateAdjEdgeIdx(ThisNId, Idx);
77 std::swap(AdjEdgeIds[Idx], AdjEdgeIds.back());
76 G.getEdge(AdjEdgeIds.back()).setAdjEdgeIdx(ThisNId, Idx);
77 AdjEdgeIds[Idx] = AdjEdgeIds.back();
7878 AdjEdgeIds.pop_back();
7979 }
8080
124124 connectToN(G, ThisEdgeId, 1);
125125 }
126126
127 void updateAdjEdgeIdx(NodeId NId, typename NodeEntry::AdjEdgeIdx NewIdx) {
127 void setAdjEdgeIdx(NodeId NId, typename NodeEntry::AdjEdgeIdx NewIdx) {
128128 if (NId == NIds[0])
129129 ThisEdgeAdjIdxs[0] = NewIdx;
130130 else {