diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-10-10 21:48:37 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-10-10 21:48:37 +0200 |
commit | 41f350e672007ee64657b4ac67ffc95229ad841d (patch) | |
tree | 17d82455a90e1a4604a59638919cb28b893ddadc /include/inttypes.h | |
parent | m todo (diff) | |
download | slibc-41f350e672007ee64657b4ac67ffc95229ad841d.tar.gz slibc-41f350e672007ee64657b4ac67ffc95229ad841d.tar.bz2 slibc-41f350e672007ee64657b4ac67ffc95229ad841d.tar.xz |
add abs, labs, llabs, and imaxabs
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'include/inttypes.h')
-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 |