Functions for basic mathematical operations.
More...
|
#define | TF_BITS_FOR_VALUES(n) |
| Compute the number of bits required to store the given number of values.
|
|
#define | TF_BITS_FOR_ENUM_VALUES(n) |
| Compute the number of bits required to store the given number of (signed) enum values.
|
|
|
int | TfAbs (int v) |
| Returns the absolute value of the given int value.
|
|
double | TfAbs (double v) |
| Returns the absolute value of the given double value.
|
|
template<class T > |
T | TfMin (const T &v1, const T &v2) |
| Returns the smaller of the two given values .
|
|
template<class T > |
T | TfMax (const T &v1, const T &v2) |
| Returns the larger of the two given values .
|
|
Functions for basic mathematical operations.
◆ TF_BITS_FOR_ENUM_VALUES
#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.
◆ TF_BITS_FOR_VALUES
#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.
◆ TfAbs() [1/2]
Returns the absolute value of the given double
value.
Definition at line 66 of file tf.h.
◆ TfAbs() [2/2]
Returns the absolute value of the given int
value.
Definition at line 61 of file tf.h.
◆ TfMax()
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.
◆ TfMin()
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.