Return true if the update makes the destination of the edge ready to run.
| 50 | |
| 51 | // Return true if the update makes the destination of the edge ready to run. |
| 52 | bool UpdatePending(const Edge* edge, std::vector<int>* pending_count) { |
| 53 | const Node* out = edge->dst(); |
| 54 | if (IsMerge(out)) { |
| 55 | if (edge->IsControlEdge()) { |
| 56 | (*pending_count)[out->id()] -= 2; |
| 57 | // Return true if we already got at least one input edge |
| 58 | // and a control edge is the enabling one. |
| 59 | return ((*pending_count)[out->id()] == 1); |
| 60 | } else { |
| 61 | int count = (*pending_count)[out->id()]; |
| 62 | (*pending_count)[out->id()] |= 0x1; |
| 63 | // If the first input edge is the enabling one, the count goes from |
| 64 | // 0 to 1 in this step. Return true iff count was zero. |
| 65 | return (count == 0); |
| 66 | } |
| 67 | } else { |
| 68 | return (--(*pending_count)[out->id()] == 0); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | } // end namespace |
| 73 |
no test coverage detected