From 683a0f61199429bf7a124da07fffa20ba5286af9 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 18 Aug 2018 17:15:27 +0200 Subject: [PATCH] Fixed warnings --- test/core/core_setup_simd.cpp | 48 +++++++++++++---------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/test/core/core_setup_simd.cpp b/test/core/core_setup_simd.cpp index b8f3de01..72b1327d 100644 --- a/test/core/core_setup_simd.cpp +++ b/test/core/core_setup_simd.cpp @@ -11,8 +11,6 @@ template static void test_mat_mul_vec(matType const& M, std::vector const& I, std::vector& O) { - typedef typename vecType::value_type T; - for (std::size_t i = 0, n = I.size(); i < n; ++i) O[i] = M * I[i]; } @@ -42,8 +40,6 @@ static int launch_mat_mul_vec(std::size_t Samples) template static void test_vec_mul_mat(matType const& M, std::vector const& I, std::vector& O) { - typedef typename vecType::value_type T; - for (std::size_t i = 0, n = I.size(); i < n; ++i) O[i] = I[i] * M; } @@ -62,7 +58,7 @@ static int launch_vec_mul_mat(std::size_t Samples) I[i] = vecType(static_cast(i)) * vecType(0.01, 0.02, 0.03, 0.05); std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); - test_mat_mul_vec(Transform, I, O); + test_vec_mul_mat(Transform, I, O); std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now(); return static_cast(std::chrono::duration_cast(t2 - t1).count()); @@ -71,8 +67,6 @@ static int launch_vec_mul_mat(std::size_t Samples) template static void test_mat_mul_mat(matType const& M, std::vector const& I, std::vector& O) { - typedef typename matType::value_type T; - for (std::size_t i = 0, n = I.size(); i < n; ++i) O[i] = M * I[i]; } @@ -84,26 +78,22 @@ static int launch_mat_mul_mat(std::size_t Samples) static const matType Transform(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - { - std::vector I(Samples); - std::vector O(Samples); + std::vector I(Samples); + std::vector O(Samples); - for(std::size_t i = 0; i < Samples; ++i) - I[i] = matType(static_cast(i)) * matType(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05); + for(std::size_t i = 0; i < Samples; ++i) + I[i] = matType(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05) * static_cast(i); - std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); - test_mat_mul_mat(Transform, I, O); - std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now(); + std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); + test_mat_mul_mat(Transform, I, O); + std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now(); - return static_cast(std::chrono::duration_cast(t2 - t1).count()); - } + return static_cast(std::chrono::duration_cast(t2 - t1).count()); } template static void test_mat_div_mat(matType const& M, std::vector const& I, std::vector& O) { - typedef typename matType::value_type T; - for (std::size_t i = 0, n = I.size(); i < n; ++i) O[i] = M / I[i]; } @@ -112,22 +102,20 @@ template static int launch_mat_div_mat(std::size_t Samples) { typedef typename matType::value_type T; - + static const matType Transform(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - { - std::vector I(Samples); - std::vector O(Samples); + std::vector I(Samples); + std::vector O(Samples); - for(std::size_t i = 0; i < Samples; ++i) - I[i] = matType(static_cast(i)) * matType(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05); + for(std::size_t i = 0; i < Samples; ++i) + I[i] = matType(0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05, 0.01, 0.02, 0.03, 0.05) * static_cast(i); - std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); - test_mat_div_mat(Transform, I, O); - std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now(); + std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); + test_mat_div_mat(Transform, I, O); + std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now(); - return static_cast(std::chrono::duration_cast(t2 - t1).count()); - } + return static_cast(std::chrono::duration_cast(t2 - t1).count()); } int main()