From: hartmann Date: Wed, 17 Mar 2004 12:39:36 +0000 (+0000) Subject: UpdateFlags by value rather than by reference. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be37ba108f105783fb9bcdd161a1b3c1c1215a66;p=dealii-svn.git UpdateFlags by value rather than by reference. git-svn-id: https://svn.dealii.org/trunk@8800 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/fe_update_flags.h b/deal.II/deal.II/include/fe/fe_update_flags.h index e2d7f9f727..2610c0cc8c 100644 --- a/deal.II/deal.II/include/fe/fe_update_flags.h +++ b/deal.II/deal.II/include/fe/fe_update_flags.h @@ -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 (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 ( + static_cast (f1) | + static_cast (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 (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 ( + static_cast (f1) & + static_cast (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