| 175 | } |
| 176 | |
| 177 | void SwapFanoutsMapValues(FanoutsMap* fanouts, |
| 178 | const MutableGraphView::OutputPort& from_port, |
| 179 | const FanoutsMap::iterator& from_fanouts, |
| 180 | const MutableGraphView::OutputPort& to_port, |
| 181 | const FanoutsMap::iterator& to_fanouts) { |
| 182 | const bool from_exists = from_fanouts != fanouts->end(); |
| 183 | const bool to_exists = to_fanouts != fanouts->end(); |
| 184 | |
| 185 | if (from_exists && to_exists) { |
| 186 | std::swap(from_fanouts->second, to_fanouts->second); |
| 187 | } else if (from_exists) { |
| 188 | fanouts->emplace(to_port, std::move(from_fanouts->second)); |
| 189 | fanouts->erase(from_port); |
| 190 | } else if (to_exists) { |
| 191 | fanouts->emplace(from_port, std::move(to_fanouts->second)); |
| 192 | fanouts->erase(to_port); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | void SwapRegularFanoutsAndMaxPortValues(FanoutsMap* fanouts, |
| 197 | MaxOutputPortsMap* max_output_ports, |
no test coverage detected