Skip to content

Commit 785672f

Browse files
committed
[VPR] Use nature way in writing if conditions in rr_spatial_lookup.cpp
1 parent 7416c66 commit 785672f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

vpr/src/device/rr_spatial_lookup.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RRNodeId RRSpatialLookup::find_node(int x,
2929
}
3030

3131
/* Pre-check: the x, y, side and ptc should be non negative numbers! Otherwise, return an invalid id */
32-
if ((0 > x) || (0 > y) || (NUM_SIDES == node_side) || (0 > ptc)) {
32+
if ((x < 0) || (y < 0) || (node_side == NUM_SIDES) || (ptc < 0)) {
3333
return RRNodeId::INVALID();
3434
}
3535

@@ -41,7 +41,7 @@ RRNodeId RRSpatialLookup::find_node(int x,
4141
*/
4242
size_t node_x = x;
4343
size_t node_y = y;
44-
if (CHANX == type) {
44+
if (type == CHANX) {
4545
std::swap(node_x, node_y);
4646
}
4747

@@ -83,7 +83,7 @@ std::vector<RRNodeId> RRSpatialLookup::find_channel_nodes(int x,
8383
std::vector<RRNodeId> channel_nodes;
8484

8585
/* Pre-check: the x, y, type are valid! Otherwise, return an empty vector */
86-
if ((0 > x || 0 > y) && (CHANX == type || CHANY == type)) {
86+
if ((x < 0 || y < 0) && (type == CHANX || type == CHANY)) {
8787
return channel_nodes;
8888
}
8989

@@ -95,7 +95,7 @@ std::vector<RRNodeId> RRSpatialLookup::find_channel_nodes(int x,
9595
*/
9696
size_t node_x = x;
9797
size_t node_y = y;
98-
if (CHANX == type) {
98+
if (type == CHANX) {
9999
std::swap(node_x, node_y);
100100
}
101101

@@ -194,8 +194,8 @@ void RRSpatialLookup::resize_nodes(int x,
194194
* should ensure the fast look-up well organized
195195
*/
196196
VTR_ASSERT(type < rr_node_indices_.size());
197-
VTR_ASSERT(0 <= x);
198-
VTR_ASSERT(0 <= y);
197+
VTR_ASSERT(x >= 0);
198+
VTR_ASSERT(y >= 0);
199199

200200
if ((x >= int(rr_node_indices_[type].dim_size(0)))
201201
|| (y >= int(rr_node_indices_[type].dim_size(1)))

0 commit comments

Comments
 (0)