]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
UpdateFlags by value rather than by reference.
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Mar 2004 12:39:36 +0000 (12:39 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Mar 2004 12:39:36 +0000 (12:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@8800 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/fe_update_flags.h

index e2d7f9f7271b439d2890ec54e8be449f5d90e61b..2610c0cc8c99d5557bea751251907db362b3349f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -119,18 +119,6 @@ enum UpdateFlags
 
 
 
-/**
- * Global operator which sets the bits from the second argument also
- * in the first one.
- */
-inline
-UpdateFlags &
-operator |= (UpdateFlags &f1, const UpdateFlags &f2)
-{
-  f1 = static_cast<UpdateFlags> (f1 | f2);
-  return f1;
-}
-
 
 
 /**
@@ -143,29 +131,29 @@ operator |= (UpdateFlags &f1, const UpdateFlags &f2)
  */
 inline
 UpdateFlags
-operator | (const UpdateFlags &f1, const UpdateFlags &f2)
+operator | (UpdateFlags f1, UpdateFlags f2)
 {
-  UpdateFlags result = f1;
-  result |= f2;
-  return result;
+  return static_cast<UpdateFlags> (
+    static_cast<unsigned int> (f1) |
+    static_cast<unsigned int> (f2));
 }
 
 
 
+
 /**
- * Global operator which clears all the bits in the first argument if
- * they are not also set in the second argument.
+ * Global operator which sets the bits from the second argument also
+ * in the first one.
  */
 inline
 UpdateFlags &
-operator &= (UpdateFlags &f1, const UpdateFlags &f2)
+operator |= (UpdateFlags &f1, UpdateFlags f2)
 {
-  f1 = static_cast<UpdateFlags> (f1 & f2);
+  f1 = f1 | f2;
   return f1;
 }
 
 
-
 /**
  * Global operator which returns an object in which all bits are set
  * which are set in the first as well as the second argument. This
@@ -176,13 +164,28 @@ operator &= (UpdateFlags &f1, const UpdateFlags &f2)
  */
 inline
 UpdateFlags
-operator & (const UpdateFlags& f1, const UpdateFlags& f2)
+operator & (UpdateFlags f1, UpdateFlags f2)
+{
+  return static_cast<UpdateFlags> (
+    static_cast<unsigned int> (f1) &
+    static_cast<unsigned int> (f2));
+}
+
+
+/**
+ * Global operator which clears all the bits in the first argument if
+ * they are not also set in the second argument.
+ */
+inline
+UpdateFlags &
+operator &= (UpdateFlags &f1, UpdateFlags f2)
 {
-  UpdateFlags result = f1;
-  result &= f2;
-  return result;
+  f1 = f1 & f2;
+  return f1;
 }
 
+
+
 /*@}*/
 
 #endif

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.