| Q D E V _ H L P _ M I N ( )
| | | | | SOURCE: qdev_macros.txt 1.16 (12/09/2014) English INDEP - PUBLIC
----------------------------------------------------------------------------
NAME
QDEV_HLP_MIN() - Picks the lowest from two passed in
values.
SYNOPSIS
c = QDEV_HLP_MIN(a, b);
[LONG] QDEV_HLP_MIN([LONG], [LONG]);
FUNCTION
This macro allows to pick the lowest possible value out
of two values as passed in.
INPUTS
a - First value of any type that can hold an integer.
b - Second value of any type that can hold an integer.
RETURNS
Returns a or b depending on what is less than the other
argument.
BASES
None.
NOTES
This macro can cause side effects, due to multiple arg.
evaluation! Make sure that what you pass are just the
arguments or constants or non-permanent statements.
SEE ALSO
QDEV_HLP_MAX(), QDEV_HLP_ABS(),
QDEV_HLP_NEG(), QDEV_HLP_FLIP()
EXAMPLE
#include <qdev.h>
...
LONG x = 6;
LONG y = 3;
LONG z;
/*
* Example of the right usage, so no side effects will
* occurr.
*/
z = QDEV_HLP_MIN((x - 1), y);
/*
* Example of side effect statement which can turn the
* code into bad state.
*/
z = QDEV_HLP_MIN(x--, y);
...
BUGS
None known.
----------------------------------------------------------------------------
| |
| |