[PATCH] libc/sysdeps/linux/common/bits/wchar.h: resync with glibc, fix build issue...
[uclibc-ng.git] / libc / sysdeps / linux / common / bits / uClibc_uwchar.h
blob47ea3cda116c757e552676568271d59bea6f9400
1 /* Copyright (C) 2003 Manuel Novoa III
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * The GNU C Library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with the GNU C Library; see the file COPYING.LIB. If
15 * not, see <http://www.gnu.org/licenses/>.
18 /* ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION!
20 * Besides uClibc, I'm using this code in my libc for elks, which is
21 * a 16-bit environment with a fairly limited compiler. It would make
22 * things much easier for me if this file isn't modified unnecessarily.
23 * In particular, please put any new or replacement functions somewhere
24 * else, and modify the makefile to use your version instead.
25 * Thanks. Manuel
27 * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */
30 /* Define an internal unsigned int type __uwchar_t just large enough
31 * to hold a wchar_t.
34 #ifndef _UCLIBC_UWCHAR_H
35 #define _UCLIBC_UWCHAR_H
37 #include <limits.h>
38 #include <stdint.h>
40 #if WCHAR_MIN == 0
41 typedef wchar_t __uwchar_t;
42 #elif WCHAR_MAX <= USHRT_MAX
43 typedef unsigned short __uwchar_t;
44 #elif WCHAR_MAX <= UINT_MAX
45 typedef unsigned int __uwchar_t;
46 #elif WCHAR_MAX <= ULONG_MAX
47 typedef unsigned long __uwchar_t;
48 #elif defined(ULLONG_MAX) && (WCHAR_MAX <= ULLONG_MAX)
49 typedef unsigned long long __uwchar_t;
50 #elif WCHAR_MAX <= UINTMAX_MAX
51 typedef uintmax_t __uwchar_t;
52 #else
53 #error Can not determine an appropriate type for __uwchar_t!
54 #endif
56 #endif /* _UCLIBC_UWCHAR_H */