1 | */* wchar_t type related definitions.* |

2 | * Copyright (C) 2000-2022 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 | * <https://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 | |