From 33c7a4e53ba99e0f81496af430a1e5db82068c48 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 1 Feb 2021 09:28:14 -0800 Subject: [PATCH 1/2] Simplify initialization of vector with a known number of elements. Signed-off-by: Henner Zeller --- vpr/src/route/cb_metrics.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vpr/src/route/cb_metrics.cpp b/vpr/src/route/cb_metrics.cpp index a4152b46340..5982d7f661f 100644 --- a/vpr/src/route/cb_metrics.cpp +++ b/vpr/src/route/cb_metrics.cpp @@ -1201,10 +1201,7 @@ static void normalize_xbar(const float fraction_wires_used, t_xbar_matrix* xbar) /* 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 * this vector is created here, but is updated inside the count_switch_configurations function */ - std::vector config; - for (int i = 0; i < (int)count_map.size(); i++) { - config.push_back(0); - } + std::vector config(count_map.size(), 0); // Prefill with zeroes /* the nuber of wires that are used */ int wires_used = vtr::nint(fraction_wires_used * (float)capacity); From 6d0627c5b5215b7e49475001ecc5c6ba9eefe51a Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 1 Feb 2021 09:38:10 -0800 Subject: [PATCH 2/2] Update code formatting. Signed-off-by: Henner Zeller --- vpr/src/route/cb_metrics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vpr/src/route/cb_metrics.cpp b/vpr/src/route/cb_metrics.cpp index 5982d7f661f..bb020c46958 100644 --- a/vpr/src/route/cb_metrics.cpp +++ b/vpr/src/route/cb_metrics.cpp @@ -1201,7 +1201,7 @@ static void normalize_xbar(const float fraction_wires_used, t_xbar_matrix* xbar) /* 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 * this vector is created here, but is updated inside the count_switch_configurations function */ - std::vector config(count_map.size(), 0); // Prefill with zeroes + std::vector config(count_map.size(), 0); // Prefill with zeroes /* the nuber of wires that are used */ int wires_used = vtr::nint(fraction_wires_used * (float)capacity);