1214152Sed/*===-- negvti2.c - Implement __negvti2 -----------------------------------=== 2214152Sed * 3214152Sed * The LLVM Compiler Infrastructure 4214152Sed * 5222656Sed * This file is dual licensed under the MIT and the University of Illinois Open 6222656Sed * Source Licenses. See LICENSE.TXT for details. 7214152Sed * 8214152Sed *===----------------------------------------------------------------------=== 9214152Sed * 10214152Sed *This file implements __negvti2 for the compiler_rt library. 11214152Sed * 12214152Sed *===----------------------------------------------------------------------=== 13214152Sed */ 14214152Sed 15239138Sandrew#include "int_lib.h" 16239138Sandrew 17263763Sdim#ifdef CRT_HAS_128BIT 18214152Sed 19214152Sed/* Returns: -a */ 20214152Sed 21214152Sed/* Effects: aborts if -a overflows */ 22214152Sed 23214152Sedti_int 24214152Sed__negvti2(ti_int a) 25214152Sed{ 26214152Sed const ti_int MIN = (ti_int)1 << ((int)(sizeof(ti_int) * CHAR_BIT)-1); 27214152Sed if (a == MIN) 28214152Sed compilerrt_abort(); 29214152Sed return -a; 30214152Sed} 31214152Sed 32263763Sdim#endif /* CRT_HAS_128BIT */ 33