@@ -716,24 +716,29 @@ SACoreSoftMacro::NotchVicinity SACoreSoftMacro::checkNotchVicinity(
716716 return vicnity;
717717}
718718
719- bool SACoreSoftMacro::isSegmentEmpty (const std::vector<std::vector<bool >>& grid,
720- const int start_row,
721- const int start_col,
722- const int end_row,
723- const int end_col)
719+ bool SACoreSoftMacro::isRowEmpty (const std::vector<std::vector<bool >>& grid,
720+ const int row,
721+ const int start_col,
722+ const int end_col)
724723{
725- for (int i = start_row; i <= end_row; i ++) {
726- if (grid[i][end_col ]) {
724+ for (int col = start_col; col <= end_col; col ++) {
725+ if (grid[row][col ]) {
727726 return false ;
728727 }
729728 }
729+ return true ;
730+ }
730731
731- for (int j = start_col; j <= end_col; j++) {
732- if (grid[end_row][j]) {
732+ bool SACoreSoftMacro::isColEmpty (const std::vector<std::vector<bool >>& grid,
733+ const int col,
734+ const int start_row,
735+ const int end_row)
736+ {
737+ for (int row = start_row; row <= end_row; row++) {
738+ if (grid[row][col]) {
733739 return false ;
734740 }
735741 }
736-
737742 return true ;
738743}
739744
@@ -821,7 +826,7 @@ void SACoreSoftMacro::calNotchPenalty()
821826 if (expand_rows) {
822827 end_row += 1 ;
823828 if (end_row < num_y
824- && isSegmentEmpty (grid, start_row , start_col, end_row , end_col)) {
829+ && isRowEmpty (grid, end_row , start_col, end_col)) {
825830 NotchVicinity expanded_vicinity = checkNotchVicinity (
826831 grid, start_row, start_col, end_row, end_col);
827832 if (expanded_vicinity.total () > current_vicinity.total ()
@@ -840,7 +845,7 @@ void SACoreSoftMacro::calNotchPenalty()
840845 if (expand_cols) {
841846 end_col += 1 ;
842847 if (end_col < num_x
843- && isSegmentEmpty (grid, start_row, start_col , end_row, end_col )) {
848+ && isColEmpty (grid, end_col, start_row , end_row)) {
844849 NotchVicinity expanded_vicinity = checkNotchVicinity (
845850 grid, start_row, start_col, end_row, end_col);
846851 if (expanded_vicinity.total () > current_vicinity.total ()
0 commit comments