Skip to content

Commit 51cabc7

Browse files
Use std::ranges algorithms in move transactions
1 parent fc90d69 commit 51cabc7

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

vpr/src/place/move_transactions.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ std::set<t_pl_loc> t_pl_blocks_to_be_moved::determine_locations_emptied_by_move(
6161
}
6262

6363
std::set<t_pl_loc> empty_locs;
64-
std::set_difference(moved_from_set.begin(), moved_from_set.end(),
65-
moved_to_set.begin(), moved_to_set.end(),
66-
std::inserter(empty_locs, empty_locs.begin()));
64+
std::ranges::set_difference(moved_from_set, moved_to_set,
65+
std::inserter(empty_locs, empty_locs.begin()),
66+
std::less{});
6767

6868
return empty_locs;
6969
}
@@ -83,18 +83,10 @@ void t_pl_blocks_to_be_moved::clear_move_blocks() {
8383

8484
bool t_pl_blocks_to_be_moved::driven_by_moved_block(const ClusterNetId net) const {
8585
const ClusteredNetlist& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
86-
87-
bool is_driven_by_move_blk = false;
8886
ClusterBlockId net_driver_block = clb_nlist.net_driver_block(net);
8987

90-
for (const t_pl_moved_block& block : moved_blocks) {
91-
if (net_driver_block == block.block_num) {
92-
is_driven_by_move_blk = true;
93-
break;
94-
}
95-
}
96-
97-
return is_driven_by_move_blk;
88+
auto it = std::ranges::find(moved_blocks, net_driver_block, &t_pl_moved_block::block_num);
89+
return it != moved_blocks.end();
9890
}
9991

10092
void MoveAbortionLogger::log_move_abort(std::string_view reason) {

0 commit comments

Comments
 (0)