From: David Wells Date: Thu, 3 Nov 2016 13:13:32 +0000 (-0400) Subject: Silence a PVS studio warning about repeated code. X-Git-Tag: v8.5.0-rc1~492^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6df1ebea9f143c6e1973fe6428b021696d1389af;p=dealii.git 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). --- 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());