Skip to content

Commit 091c992

Browse files
committed
gpl: address clang-tidy suggestions
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
1 parent c5bcc7f commit 091c992

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

src/gpl/src/graphics.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "graphics.h"
55

6+
#include <spdlog/fmt/bundled/format.h>
7+
68
#include <algorithm>
79
#include <cmath>
810
#include <cstdint>
@@ -19,6 +21,7 @@
1921
#include "nesterovPlace.h"
2022
#include "odb/db.h"
2123
#include "placerBase.h"
24+
#include "point.h"
2225
#include "utl/Logger.h"
2326

2427
namespace gpl {
@@ -391,8 +394,8 @@ void Graphics::drawNesterov(gui::Painter& painter)
391394
const float densityPenalty = nbVec_[nb_index]->getDensityPenalty();
392395
const float density_magnitude = std::hypot(densityPenalty * densityGrad.x,
393396
densityPenalty * densityGrad.y);
394-
const float overall_x = wlGrad.x + densityPenalty * densityGrad.x;
395-
const float overall_y = wlGrad.y + densityPenalty * densityGrad.y;
397+
const float overall_x = wlGrad.x + (densityPenalty * densityGrad.x);
398+
const float overall_y = wlGrad.y + (densityPenalty * densityGrad.y);
396399
const float overall_magnitude = std::hypot(overall_x, overall_y);
397400
const float max_magnitude
398401
= std::max({wl_magnitude, density_magnitude, overall_magnitude});

src/gpl/src/nesterovBase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,8 +1981,8 @@ void NesterovBase::initFillerGCells()
19811981

19821982
// place filler cells on random coordi and
19831983
// set size as avgDx and avgDy
1984-
GCell filler_gcell(randX % region_dx + region_lx,
1985-
randY % region_dy + region_ly,
1984+
GCell filler_gcell(((randX % region_dx) + region_lx),
1985+
((randY % region_dy) + region_ly),
19861986
fillerDx_,
19871987
fillerDy_);
19881988

src/gpl/src/placerBase.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ void PlacerBase::initInstsForUnusableSites()
11261126

11271127
for (int i = pairX.first; i < pairX.second; i++) {
11281128
for (int j = pairY.first; j < pairY.second; j++) {
1129-
siteGrid[j * siteCountX + i] = Row;
1129+
siteGrid[(j * siteCountX) + i] = Row;
11301130
}
11311131
}
11321132
}
@@ -1157,7 +1157,7 @@ void PlacerBase::initInstsForUnusableSites()
11571157
for (int j = pairY.first; j < pairY.second; j++) {
11581158
for (int i = pairX.first; i < pairX.second; i++) {
11591159
if (cells == 0 || filled / (float) cells <= filler_density) {
1160-
siteGrid[j * siteCountX + i] = Blocked;
1160+
siteGrid[(j * siteCountX) + i] = Blocked;
11611161
debugPrint(log_,
11621162
GPL,
11631163
"dummies",
@@ -1201,7 +1201,7 @@ void PlacerBase::initInstsForUnusableSites()
12011201
inst->ly(), inst->uy(), die_.coreLy(), siteSizeY_, 0, siteCountY);
12021202
for (int i = pairX.first; i < pairX.second; i++) {
12031203
for (int j = pairY.first; j < pairY.second; j++) {
1204-
siteGrid[j * siteCountX + i] = FixedInst;
1204+
siteGrid[(j * siteCountX) + i] = FixedInst;
12051205
debugPrint(log_,
12061206
GPL,
12071207
"dummies",
@@ -1220,17 +1220,17 @@ void PlacerBase::initInstsForUnusableSites()
12201220
//
12211221
for (int j = 0; j < siteCountY; j++) {
12221222
for (int i = 0; i < siteCountX; i++) {
1223-
if (siteGrid[j * siteCountX + i] == Blocked) {
1223+
if (siteGrid[(j * siteCountX) + i] == Blocked) {
12241224
int startX = i;
12251225
// find end points
1226-
while (i < siteCountX && siteGrid[j * siteCountX + i] == Blocked) {
1226+
while (i < siteCountX && siteGrid[(j * siteCountX) + i] == Blocked) {
12271227
i++;
12281228
}
12291229
int endX = i;
1230-
Instance dummy_gcell(die_.coreLx() + siteSizeX_ * startX,
1231-
die_.coreLy() + siteSizeY_ * j,
1232-
die_.coreLx() + siteSizeX_ * endX,
1233-
die_.coreLy() + siteSizeY_ * (j + 1));
1230+
Instance dummy_gcell(die_.coreLx() + (siteSizeX_ * startX),
1231+
die_.coreLy() + (siteSizeY_ * j),
1232+
die_.coreLx() + (siteSizeX_ * endX),
1233+
die_.coreLy() + (siteSizeY_ * (j + 1)));
12341234
instStor_.push_back(dummy_gcell);
12351235
}
12361236
}

0 commit comments

Comments
 (0)