]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Take over r27494 from branch_cmake:
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Nov 2012 11:29:59 +0000 (11:29 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Nov 2012 11:29:59 +0000 (11:29 +0000)
Remove an unnecessary micro optimization that triggers -Warray-bounds

git-svn-id: https://svn.dealii.org/trunk@27499 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/tensor_base.h

index 0627a6dfb2a295fa11212969d621eca4b6626653..0aae6643f327e28e92ca9342884db89ab889f89f 100644 (file)
@@ -975,30 +975,9 @@ inline
 Tensor<1,dim,Number> &
 Tensor<1,dim,Number>::operator = (const Tensor<1,dim,Number> &p)
 {
-                                   // unroll by hand since this is a
-                                   // frequently called function and
-                                   // some compilers don't want to
-                                   // always unroll the loop in the
-                                   // general template
-  switch (dim)
-    {
-    case 1:
-      values[0] = p.values[0];
-      break;
-    case 2:
-      values[0] = p.values[0];
-      values[1] = p.values[1];
-      break;
-    case 3:
+  for (unsigned int i=0; i<dim; ++i)
+    values[i] = p.values[i];
 
-      values[0] = p.values[0];
-      values[1] = p.values[1];
-      values[2] = p.values[2];
-      break;
-    default:
-      for (unsigned int i=0; i<dim; ++i)
-        values[i] = p.values[i];
-    }
   return *this;
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.