From 6df1ebea9f143c6e1973fe6428b021696d1389af Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 3 Nov 2016 09:13:32 -0400 Subject: [PATCH] Silence a PVS studio warning about repeated code. What we had is correct, but this patch should fix the warning (and make a little less work for the optimizer). --- source/base/function_lib.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/base/function_lib.cc b/source/base/function_lib.cc index e4ff6b14a4..a2f3b0e244 100644 --- a/source/base/function_lib.cc +++ b/source/base/function_lib.cc @@ -1049,12 +1049,12 @@ namespace Functions break; case 2: result[0] = std::exp(p(0)) * std::exp(p(1)); - result[1] = std::exp(p(0)) * std::exp(p(1)); + result[1] = result[0]; break; case 3: result[0] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2)); - result[1] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2)); - result[2] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2)); + result[1] = result[0]; + result[2] = result[0]; break; default: Assert(false, ExcNotImplemented()); @@ -1081,12 +1081,12 @@ namespace Functions break; case 2: gradients[i][0] = std::exp(p(0)) * std::exp(p(1)); - gradients[i][1] = std::exp(p(0)) * std::exp(p(1)); + gradients[i][1] = gradients[i][0]; break; case 3: gradients[i][0] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2)); - gradients[i][1] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2)); - gradients[i][2] = std::exp(p(0)) * std::exp(p(1)) * std::exp(p(2)); + gradients[i][1] = gradients[i][0]; + gradients[i][2] = gradients[i][0]; break; default: Assert(false, ExcNotImplemented()); -- 2.39.5