aboutsummaryrefslogblamecommitdiffstats
path: root/imaxabs.c
blob: 22d3d1034c029fecc5a7c6563304ae56fb0e0577 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                         
                                      





                                                                                  
/* 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_save_backtrace(NULL);
	liberror_set_error_errno("The absolute value of largest negative integer "
	                         "cannot be represented as a signed integer",
	                         "imaxabs", EOVERFLOW);
	return i;
#endif
}