1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

PBQP: Minor cleanups to r204857

* Use assignment instead of swap (since the original value is being
  destroyed anyway)

* Rename "updateAdjEdgeId" to "setAdjEdgeId"

llvm-svn: 204983
This commit is contained in:
David Blaikie 2014-03-27 23:42:21 +00:00
parent 3324d55193
commit 11a640aa93

View File

@ -70,12 +70,12 @@ namespace PBQP {
void removeAdjEdgeId(Graph &G, NodeId ThisNId, AdjEdgeIdx Idx) {
// Swap-and-pop for fast removal.
// 1) Update the adj index of the edge currently at back().
// 2) Swap Edge at Idx with back().
// 2) Move last Edge down to Idx.
// 3) pop_back()
// If Idx == size() - 1 then the updateAdjEdgeIdx and swap are
// If Idx == size() - 1 then the setAdjEdgeIdx and swap are
// redundant, but both operations are cheap.
G.getEdge(AdjEdgeIds.back()).updateAdjEdgeIdx(ThisNId, Idx);
std::swap(AdjEdgeIds[Idx], AdjEdgeIds.back());
G.getEdge(AdjEdgeIds.back()).setAdjEdgeIdx(ThisNId, Idx);
AdjEdgeIds[Idx] = AdjEdgeIds.back();
AdjEdgeIds.pop_back();
}
@ -125,7 +125,7 @@ namespace PBQP {
connectToN(G, ThisEdgeId, 1);
}
void updateAdjEdgeIdx(NodeId NId, typename NodeEntry::AdjEdgeIdx NewIdx) {
void setAdjEdgeIdx(NodeId NId, typename NodeEntry::AdjEdgeIdx NewIdx) {
if (NId == NIds[0])
ThisEdgeAdjIdxs[0] = NewIdx;
else {