summaryrefslogtreecommitdiffstats
path: root/contrib/libs/nvidia/cccl/libcudacxx/include/cuda/std/climits
blob: dc16a3a322951cbd842f5cc7443e6e6f2e5b36f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//===----------------------------------------------------------------------===//
//
// Part of libcu++, the C++ Standard Library for your entire system,
// under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//

#ifndef _CUDA_STD_CLIMITS
#define _CUDA_STD_CLIMITS

#include <cuda/std/detail/__config>

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
#  pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
#  pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
#  pragma system_header
#endif // no system header

#if !_CCCL_COMPILER(NVRTC)
#  include <climits>
#else // ^^^ !_CCCL_COMPILER(NVRTC) ^^^ / vvv _CCCL_COMPILER(NVRTC) vvv
#  define _CCCL_CHAR_IS_UNSIGNED() ('\xff' > 0) // CURSED

#  define CHAR_BIT 8

#  define SCHAR_MIN (-128)
#  define SCHAR_MAX 127
#  define UCHAR_MAX 255

#  if _CCCL_CHAR_IS_UNSIGNED()
#    define CHAR_MIN 0
#    define CHAR_MAX UCHAR_MAX
#  else
#    define CHAR_MIN SCHAR_MIN
#    define CHAR_MAX SCHAR_MAX
#  endif
#  define SHRT_MIN  (-SHRT_MAX - 1)
#  define SHRT_MAX  0x7fff
#  define USHRT_MAX 0xffff
#  define INT_MIN   (-INT_MAX - 1)
#  define INT_MAX   0x7fffffff
#  define UINT_MAX  0xffffffff
#  define LONG_MIN  (-LONG_MAX - 1)
#  ifdef __LP64__
#    define LONG_MAX  LLONG_MAX
#    define ULONG_MAX ULLONG_MAX
#  else
#    define LONG_MAX  INT_MAX
#    define ULONG_MAX UINT_MAX
#  endif
#  define LLONG_MIN  (-LLONG_MAX - 1)
#  define LLONG_MAX  0x7fffffffffffffffLL
#  define ULLONG_MAX 0xffffffffffffffffUL
#endif // _CCCL_COMPILER(NVRTC)

#endif // _CUDA_STD_CLIMITS