diff options
Diffstat (limited to '')
-rw-r--r-- | include/inttypes.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/inttypes.h b/include/inttypes.h index 3f24e9b..4530fef 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -40,6 +40,20 @@ imaxdiv_t imaxdiv(intmax_t, intmax_t) __GCC_ONLY(__attribute__((const))); +/** + * Return the absolute value of an integer. + * + * Be aware, if the value is `INTMAX_MIN` and + * `-INTMAX_MAX != -INTMAX_MIN`, the result will + * overflow, and `INTMAX_MIN` will (probably) + * be returned. + * + * @param value The integer. + * @return The absolute value of the integer. + */ +intmax_t imaxabs(intmax_t) + __GCC_ONLY(__attribute__((const))); + #endif |