diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-11-17 02:31:11 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-11-17 02:31:11 +0100 |
commit | ae942840140e38835e562e8d235578c017d00766 (patch) | |
tree | f71696eba1addd25ad0393926a3f0787f26a2e98 /include/inttypes.h | |
parent | split abs.c (diff) | |
download | slibc-ae942840140e38835e562e8d235578c017d00766.tar.gz slibc-ae942840140e38835e562e8d235578c017d00766.tar.bz2 slibc-ae942840140e38835e562e8d235578c017d00766.tar.xz |
add macros for 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 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/inttypes.h b/include/inttypes.h index 9463412..d99b334 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -57,8 +57,9 @@ imaxdiv_t imaxdiv(intmax_t, intmax_t) * @param value The integer. * @return The absolute value of the integer. */ -intmax_t imaxabs(intmax_t) +intmax_t (imaxabs)(intmax_t) __GCC_ONLY(__attribute__((__const__))); +#define imaxabs(value) ((intmax_t)value < 0 ? -(intmax_t)value : (intmax_t)value) |