Path: blob/master/tools/android-sdk/renderscript/clang-include/limits.h
496 views
/*===---- limits.h - Standard header for integer sizes --------------------===*\1*2* Copyright (c) 2009 Chris Lattner3*4* Permission is hereby granted, free of charge, to any person obtaining a copy5* of this software and associated documentation files (the "Software"), to deal6* in the Software without restriction, including without limitation the rights7* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell8* copies of the Software, and to permit persons to whom the Software is9* furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be included in12* all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN20* THE SOFTWARE.21*22\*===----------------------------------------------------------------------===*/2324#ifndef __CLANG_LIMITS_H25#define __CLANG_LIMITS_H2627/* The system's limits.h may, in turn, try to #include_next GCC's limits.h.28Avert this #include_next madness. */29#if defined __GNUC__ && !defined _GCC_LIMITS_H_30#define _GCC_LIMITS_H_31#endif3233/* System headers include a number of constants from POSIX in <limits.h>.34Include it if we're hosted. */35#if __STDC_HOSTED__ && __has_include_next(<limits.h>)36#include_next <limits.h>37#endif3839/* Many system headers try to "help us out" by defining these. No really, we40know how big each datatype is. */41#undef SCHAR_MIN42#undef SCHAR_MAX43#undef UCHAR_MAX44#undef SHRT_MIN45#undef SHRT_MAX46#undef USHRT_MAX47#undef INT_MIN48#undef INT_MAX49#undef UINT_MAX50#undef LONG_MIN51#undef LONG_MAX52#undef ULONG_MAX5354#undef CHAR_BIT55#undef CHAR_MIN56#undef CHAR_MAX5758/* C90/99 5.2.4.2.1 */59#define SCHAR_MAX __SCHAR_MAX__60#define SHRT_MAX __SHRT_MAX__61#define INT_MAX __INT_MAX__62#define LONG_MAX __LONG_MAX__6364#define SCHAR_MIN (-__SCHAR_MAX__-1)65#define SHRT_MIN (-__SHRT_MAX__ -1)66#define INT_MIN (-__INT_MAX__ -1)67#define LONG_MIN (-__LONG_MAX__ -1L)6869#define UCHAR_MAX (__SCHAR_MAX__*2 +1)70#define USHRT_MAX (__SHRT_MAX__ *2 +1)71#define UINT_MAX (__INT_MAX__ *2U +1U)72#define ULONG_MAX (__LONG_MAX__ *2UL+1UL)7374#ifndef MB_LEN_MAX75#define MB_LEN_MAX 176#endif7778#define CHAR_BIT __CHAR_BIT__7980#ifdef __CHAR_UNSIGNED__ /* -funsigned-char */81#define CHAR_MIN 082#define CHAR_MAX UCHAR_MAX83#else84#define CHAR_MIN SCHAR_MIN85#define CHAR_MAX __SCHAR_MAX__86#endif8788/* C99 5.2.4.2.1: Added long long.89C++11 18.3.3.2: same contents as the Standard C Library header <limits.h>.90*/91#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L9293#undef LLONG_MIN94#undef LLONG_MAX95#undef ULLONG_MAX9697#define LLONG_MAX __LONG_LONG_MAX__98#define LLONG_MIN (-__LONG_LONG_MAX__-1LL)99#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)100#endif101102/* LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX are a GNU extension. It's too bad103that we don't have something like #pragma poison that could be used to104deprecate a macro - the code should just use LLONG_MAX and friends.105*/106#if defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)107108#undef LONG_LONG_MIN109#undef LONG_LONG_MAX110#undef ULONG_LONG_MAX111112#define LONG_LONG_MAX __LONG_LONG_MAX__113#define LONG_LONG_MIN (-__LONG_LONG_MAX__-1LL)114#define ULONG_LONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)115#endif116117#endif /* __CLANG_LIMITS_H */118119120