aboutsummaryrefslogblamecommitdiffstats
path: root/imaxabs.c
blob: cffacc2bcf3b9493c25cef97450a0403e1aa193c (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"


intmax_t
liberror_imaxabs(intmax_t i)
{
#if INTMAX_MIN == -INTMAX_MAX
	return imaxabs(i);
#else
	if (i != INTMAX_MIN)
		return imaxabs(i);
	liberror_set_error_errno("The absolute value of largest negative integer "
	                         "cannot be represented as a signed integer",
	                         "imaxabs", EOVERFLOW);
	return i;
#endif
}