All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Basic Mathematical Operations

Functions for basic mathematical operations. More...

Files

file  bitUtils.h
 

Macros

#define TF_BITS_FOR_VALUES(n)
 Compute the number of bits required to store the given number of values. More...
 
#define TF_BITS_FOR_ENUM_VALUES(n)
 Compute the number of bits required to store the given number of (signed) enum values. More...
 

Functions

int TfAbs (int v)
 Returns the absolute value of the given int value. More...
 
double TfAbs (double v)
 Returns the absolute value of the given double value. More...
 
template<class T >
TfMin (const T &v1, const T &v2)
 Returns the smaller of the two given values. More...
 
template<class T >
TfMax (const T &v1, const T &v2)
 Returns the larger of the two given values. More...
 

Detailed Description

Functions for basic mathematical operations.

Macro Definition Documentation

#define TF_BITS_FOR_ENUM_VALUES (   n)

Compute the number of bits required to store the given number of (signed) enum values.

Note
This is intended to be used when storing enum values in a bitfield without casting the enum type to an unsigned integer. (At least GCC considers enums to be signed and hence wastes one bit when all enumerants are non-negative).

Definition at line 77 of file bitUtils.h.

#define TF_BITS_FOR_VALUES (   n)

Compute the number of bits required to store the given number of values.

Note that the computed result for a number smaller or equal to zero is undefined. The input number can be any compile-time constant.

Definition at line 44 of file bitUtils.h.

Function Documentation

int TfAbs ( int  v)
inline

Returns the absolute value of the given int value.

Definition at line 61 of file tf.h.

double TfAbs ( double  v)
inline

Returns the absolute value of the given double value.

Definition at line 66 of file tf.h.

T TfMax ( const T &  v1,
const T &  v2 
)
inline

Returns the larger of the two given values.

Definition at line 78 of file tf.h.

T TfMin ( const T &  v1,
const T &  v2 
)
inline

Returns the smaller of the two given values.

Definition at line 72 of file tf.h.