Maximum value functions utility header.
More...
Go to the source code of this file.
|
| #define | MAXOF2(a, b) |
| |
| #define | MAXOF3(a, b, c) |
| |
| #define | MAXOF4(a, b, c, d) |
| |
| #define | DISPATCH_MAXOF(_1, _2, _3, _4, NAME, ...) |
| |
| #define | MAXOF(...) |
| |
Maximum value functions utility header.
Typesafe, supporting ints and floats. Generic MAXOF interface for 2, 3, or 4 arguments. Integer promotions also cover int8_t, uint8_t, int16_t, uint16_t
- Author
- Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
◆ DISPATCH_MAXOF
| #define DISPATCH_MAXOF |
( |
| _1, |
|
|
| _2, |
|
|
| _3, |
|
|
| _4, |
|
|
| NAME, |
|
|
| ... ) |
◆ MAXOF
Value:DISPATCH_MAXOF(__VA_ARGS__, MAXOF4, MAXOF3, MAXOF2)(__VA_ARGS__)
◆ MAXOF2
Value: _Generic((a) + (b), \
signed int: max2_signed, \
unsigned int: max2_unsigned, \
float: max2_float \
)(a, b)
◆ MAXOF3
| #define MAXOF3 |
( |
| a, |
|
|
| b, |
|
|
| c ) |
◆ MAXOF4
| #define MAXOF4 |
( |
| a, |
|
|
| b, |
|
|
| c, |
|
|
| d ) |
Value:MAXOF2(MAXOF2(a, b), MAXOF2(c, d))