freebsd-dev/contrib/compiler-rt/lib/builtins/negvsi2.c

29 lines
770 B
C
Raw Normal View History

2010-10-21 19:02:02 +00:00
/* ===-- negvsi2.c - Implement __negvsi2 -----------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
2010-10-21 19:02:02 +00:00
*
* ===----------------------------------------------------------------------===
*
* This file implements __negvsi2 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "int_lib.h"
/* Returns: -a */
/* Effects: aborts if -a overflows */
2011-06-02 20:02:42 +00:00
COMPILER_RT_ABI si_int
2010-10-21 19:02:02 +00:00
__negvsi2(si_int a)
{
const si_int MIN = (si_int)1 << ((int)(sizeof(si_int) * CHAR_BIT)-1);
if (a == MIN)
compilerrt_abort();
return -a;
}