From bafb07a1644896d56ad4b8effaeaae601c5a275b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 12 Apr 2019 21:12:31 +0200 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- llabs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 llabs.c (limited to 'llabs.c') diff --git a/llabs.c b/llabs.c new file mode 100644 index 0000000..edf4c82 --- /dev/null +++ b/llabs.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "internal.h" + + +long long int +liberror_llabs(long long int i) +{ +#if LLONG_MIN == -LLONG_MAX + return llabs(i); +#else + if (i != LLONG_MIN) + return llabs(i); + liberror_set_error_errno("The absolute value of largest negative integer " + "cannot be represented as a signed integer", + "llabs", EOVERFLOW); + return i; +#endif +} -- cgit v1.2.3-70-g09d2