P99

◆ P99_ABS

#define P99_ABS (   EXPR)    (P99_SIGNED(EXPR) ? p00_abs_signed(EXPR) : P99_C(uintmax_t, EXPR))

Compute the absolute value of an integral expression.

Returns
The return type of this macro is uintmax_t. It must be so, since if we have a two's complement representation the value -INTMAX_MIN is not representable in intmax_t.

EXPR is guaranteed to be evaluated exactly once.

This macro is preferable to the C99 function imaxabs. That function forcibly returns a value of type intmax_t, and might thus fail for INTMAX_MIN.

Definition at line 648 of file p99_int.h.