Skip to content

Commit fe2bcfd

Browse files
authored
Merge pull request #1652 from hzeller/simplify-and-speed-up-vector-initialization
Simplify initialization of vector with a known number of elements.
2 parents 2dc1670 + 0f89e61 commit fe2bcfd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

vpr/src/route/cb_metrics.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,10 +1201,7 @@ static void normalize_xbar(const float fraction_wires_used, t_xbar_matrix* xbar)
12011201

12021202
/* the config vector represents some distribution of signals over available wires. i.e. x wires of type 0 get used, y wires of type 1, etc
12031203
* this vector is created here, but is updated inside the count_switch_configurations function */
1204-
std::vector<int> config;
1205-
for (int i = 0; i < (int)count_map.size(); i++) {
1206-
config.push_back(0);
1207-
}
1204+
std::vector<int> config(count_map.size(), 0); // Prefill with zeroes
12081205

12091206
/* the nuber of wires that are used */
12101207
int wires_used = vtr::nint(fraction_wires_used * (float)capacity);

0 commit comments

Comments
 (0)