FlagFunctions.h File Reference

Detailed Description

Bit operations on integer data types.

Author
Martin Bauer marti.nosp@m.n.ba.nosp@m.uer@f.nosp@m.au.d.nosp@m.e
#include "core/DataTypes.h"
#include "core/debug/Debug.h"

Namespaces

 walberla
 \file TimestepTracker.h \ingroup lbm \author Frederik Hennig frede.nosp@m.rik..nosp@m.henni.nosp@m.g@fa.nosp@m.u.de
 
 walberla::field
 

Functions

Operations on bit-masks


template<class T >
void walberla::field::addMask (T &val, T mask)
 
template<class T >
void walberla::field::removeMask (T &val, T mask)
 
template<class T >
bool walberla::field::isMaskSet (const T &val, T mask)
 
template<class T >
bool walberla::field::isPartOfMaskSet (const T &val, T mask)
 
Operations on bit-masks


template<class T >
void walberla::field::addMask (T &val, T mask)
 
template<class T >
void walberla::field::removeMask (T &val, T mask)
 
template<class T >
bool walberla::field::isMaskSet (const T &val, T mask)
 
template<class T >
bool walberla::field::isPartOfMaskSet (const T &val, T mask)
 
Operations on bit-masks using flags

Flag is defined as a mask, where exactly one bit is set. This restriction is enforced in debug mode using asserts. In release mode the following functions are equivalent to their Mask variants.

template<class T >
bool walberla::field::isFlag (T f)
 
template<class T >
void walberla::field::addFlag (T &v, T f)
 
template<class T >
void walberla::field::removeFlag (T &v, T f)
 
template<class T >
bool walberla::field::isFlagSet (const T &v, T f)
 

Operations on bit-masks using flags

Flag is defined as a mask, where exactly one bit is set. This restriction is enforced in debug mode using asserts. In release mode the following functions are equivalent to their Mask variants.

#define F_MSG   "Second parameter f=" << f << " has to be a flag (only one bit is 1)"
 
template<class T >
bool walberla::field::isFlag (T f)
 
template<class T >
void walberla::field::addFlag (T &v, T f)
 
template<class T >
void walberla::field::removeFlag (T &v, T f)
 
template<class T >
bool walberla::field::isFlagSet (const T &v, T f)
 

Macro Definition Documentation

◆ F_MSG

#define F_MSG   "Second parameter f=" << f << " has to be a flag (only one bit is 1)"