aboutsummaryrefslogblamecommitdiffstats
path: root/abs.c
blob: ebfcf1402abce06955a4278347df62f87fbbd13b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                  
/* See LICENSE file for copyright and license details. */
#include "internal.h"


int
liberror_abs(int i)
{
#if INT_MIN == -INT_MAX
	return abs(i);
#else
	if (i != INT_MIN)
		return abs(i);
	liberror_set_error_errno("The absolute value of largest negative integer "
	                         "cannot be represented as a signed integer",
	                         "abs", EOVERFLOW);
	return i;
#endif
}