@@ -192,7 +192,7 @@ static void update_td_delta_costs(const PlaceDelayModel* delay_model,
192192 bool is_src_moving);
193193
194194/* *
195- * @brief if "net" is not already stored as an affected net, mark it in ts_nets_to_update and increment the size ofts_nets_to_update .
195+ * @brief if "net" is not already stored as an affected net, add it in ts_nets_to_update.
196196 * @param net ID of a net affected by a move
197197 */
198198static void record_affected_net (const ClusterNetId net);
@@ -560,8 +560,8 @@ static bool driven_by_moved_block(const ClusterNetId net,
560560 ClusterBlockId net_driver_block = clb_nlist.net_driver_block (
561561 net);
562562
563- for (size_t block_num = 0 ; block_num < moved_blocks. size (); block_num++ ) {
564- if (net_driver_block == moved_blocks[block_num] .block_num ) {
563+ for (const auto & block : moved_blocks) {
564+ if (net_driver_block == block .block_num ) {
565565 is_driven_by_move_blk = true ;
566566 break ;
567567 }
@@ -1892,9 +1892,8 @@ static double wirelength_crossing_count(size_t fanout) {
18921892}
18931893
18941894static void set_bb_delta_cost (double & bb_delta_c) {
1895- for (size_t inet_affected = 0 ; inet_affected < ts_info.ts_nets_to_update .size ();
1896- inet_affected++) {
1897- ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
1895+ for (const auto & ts_net: ts_info.ts_nets_to_update ) {
1896+ ClusterNetId net_id = ts_net;
18981897
18991898 pl_net_cost.proposed_net_cost [net_id] = bb_updater.get_net_cost (net_id);
19001899
@@ -1916,10 +1915,10 @@ void find_affected_nets_and_update_costs(
19161915 ts_info.ts_nets_to_update .resize (0 );
19171916
19181917 /* Go through all the blocks moved. */
1919- for (size_t iblk = 0 ; iblk < blocks_affected.moved_blocks . size (); iblk++ ) {
1920- const auto & moving_block_inf = blocks_affected. moved_blocks [iblk] ;
1918+ for (const auto & block : blocks_affected.moved_blocks ) {
1919+ const auto & moving_block_inf = block ;
19211920 auto & affected_pins = blocks_affected.affected_pins ;
1922- ClusterBlockId blk = blocks_affected. moved_blocks [iblk] .block_num ;
1921+ ClusterBlockId blk = block .block_num ;
19231922
19241923 /* Go through all the pins in the moved block. */
19251924 for (ClusterPinId blk_pin : clb_nlist.block_pins (blk)) {
@@ -2029,9 +2028,8 @@ void update_move_nets() {
20292028 auto & cluster_ctx = g_vpr_ctx.clustering ();
20302029 auto & place_move_ctx = g_placer_ctx.mutable_move ();
20312030
2032- for (size_t inet_affected = 0 ; inet_affected < ts_info.ts_nets_to_update .size ();
2033- inet_affected++) {
2034- ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
2031+ for (const auto & ts_net : ts_info.ts_nets_to_update ) {
2032+ ClusterNetId net_id = ts_net;
20352033
20362034 bb_updater.set_ts_bb_coord (net_id);
20372035
@@ -2053,9 +2051,8 @@ void update_move_nets() {
20532051
20542052void reset_move_nets () {
20552053 /* Reset the net cost function flags first. */
2056- for (size_t inet_affected = 0 ; inet_affected < ts_info.ts_nets_to_update .size ();
2057- inet_affected++) {
2058- ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
2054+ for (const auto & ts_net : ts_info.ts_nets_to_update ) {
2055+ ClusterNetId net_id = ts_net;
20592056 pl_net_cost.proposed_net_cost [net_id] = -1 ;
20602057 pl_net_cost.bb_update_status [net_id] = NetUpdateState::NOT_UPDATED_YET;
20612058 }
0 commit comments