1    	/* wchar_t type related definitions.
2    	   Copyright (C) 2000-2015 Free Software Foundation, Inc.
3    	   This file is part of the GNU C Library.
4    	
5    	   The GNU C Library is free software; you can redistribute it and/or
6    	   modify it under the terms of the GNU Lesser General Public
7    	   License as published by the Free Software Foundation; either
8    	   version 2.1 of the License, or (at your option) any later version.
9    	
10   	   The GNU C Library is distributed in the hope that it will be useful,
11   	   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   	   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   	   Lesser General Public License for more details.
14   	
15   	   You should have received a copy of the GNU Lesser General Public
16   	   License along with the GNU C Library; if not, see
17   	   <http://www.gnu.org/licenses/>.  */
18   	
19   	#ifndef _BITS_WCHAR_H
20   	#define _BITS_WCHAR_H	1
21   	
22   	/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__
23   	   are not defined, give the right value and type as long as both int
24   	   and wchar_t are 32-bit types.  Adding L'\0' to a constant value
25   	   ensures that the type is correct; it is necessary to use (L'\0' +
26   	   0) rather than just L'\0' so that the type in C++ is the promoted
27   	   version of wchar_t rather than the distinct wchar_t type itself.
28   	   Because wchar_t in preprocessor #if expressions is treated as
29   	   intmax_t or uintmax_t, the expression (L'\0' - 1) would have the
30   	   wrong value for WCHAR_MAX in such expressions and so cannot be used
31   	   to define __WCHAR_MAX in the unsigned case.  */
32   	
33   	#ifdef __WCHAR_MAX__
34   	# define __WCHAR_MAX	__WCHAR_MAX__
35   	#elif L'\0' - 1 > 0
36   	# define __WCHAR_MAX	(0xffffffffu + L'\0')
37   	#else
38   	# define __WCHAR_MAX	(0x7fffffff + L'\0')
39   	#endif
40   	
41   	#ifdef __WCHAR_MIN__
42   	# define __WCHAR_MIN	__WCHAR_MIN__
43   	#elif L'\0' - 1 > 0
44   	# define __WCHAR_MIN	(L'\0' + 0)
45   	#else
46   	# define __WCHAR_MIN	(-__WCHAR_MAX - 1)
47   	#endif
48   	
49   	#endif	/* bits/wchar.h */
50