aboutsummaryrefslogtreecommitdiffstats
path: root/llabs.c
diff options
context:
space:
mode:
Diffstat (limited to 'llabs.c')
-rw-r--r--llabs.c18
1 files changed, 18 insertions, 0 deletions
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
+}