Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor <cuda/std/cstdint> #3325

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions libcudacxx/include/cuda/std/__cuda/cstdint_prelude.h

This file was deleted.

142 changes: 141 additions & 1 deletion libcudacxx/include/cuda/std/cstdint
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,149 @@
# pragma system_header
#endif // no system header

#include <cuda/std/version>

_CCCL_PUSH_MACROS

#include <cuda/std/detail/libcxx/include/cstdint>
#if !_CCCL_COMPILER(NVRTC)
# include <cstdint>
#else // ^^^ !_CCCL_COMPILER(NVRTC) ^^^ / vvv _CCCL_COMPILER(NVRTC) vvv
# include <cuda/std/climits>

using int8_t = signed char;
using int16_t = signed short;
using int32_t = signed int;
using int64_t = signed long long;
using uint8_t = unsigned char;
using uint16_t = unsigned short;
using uint32_t = unsigned int;
using uint64_t = unsigned long long;

using int_fast8_t = int8_t;
using int_fast16_t = int16_t;
using int_fast32_t = int32_t;
using int_fast64_t = int64_t;
using uint_fast8_t = uint8_t;
using uint_fast16_t = uint16_t;
using uint_fast32_t = uint32_t;
using uint_fast64_t = uint64_t;

using int_least8_t = int8_t;
using int_least16_t = int16_t;
using int_least32_t = int32_t;
using int_least64_t = int64_t;
using uint_least8_t = uint8_t;
using uint_least16_t = uint16_t;
using uint_least32_t = uint32_t;
using uint_least64_t = uint64_t;

using intptr_t = int64_t;
using uintptr_t = uint64_t;

using intmax_t = int64_t;
using uintmax_t = uint64_t;

# define INT8_MIN SCHAR_MIN
# define INT16_MIN SHRT_MIN
# define INT32_MIN INT_MIN
# define INT64_MIN LLONG_MIN
# define INT8_MAX SCHAR_MAX
# define INT16_MAX SHRT_MAX
# define INT32_MAX INT_MAX
# define INT64_MAX LLONG_MAX
# define UINT8_MAX UCHAR_MAX
# define UINT16_MAX USHRT_MAX
# define UINT32_MAX UINT_MAX
# define UINT64_MAX ULLONG_MAX

# define INT_FAST8_MIN INT8_MIN
# define INT_FAST16_MIN INT16_MIN
# define INT_FAST32_MIN INT32_MIN
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST8_MAX INT8_MAX
# define INT_FAST16_MAX INT16_MAX
# define INT_FAST32_MAX INT32_MAX
# define INT_FAST64_MAX INT64_MAX
# define UINT_FAST8_MAX UINT8_MAX
# define UINT_FAST16_MAX UINT16_MAX
# define UINT_FAST32_MAX UINT32_MAX
# define UINT_FAST64_MAX UINT64_MAX

# define INT_LEAST8_MIN INT8_MIN
# define INT_LEAST16_MIN INT16_MIN
# define INT_LEAST32_MIN INT32_MIN
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST8_MAX INT8_MAX
# define INT_LEAST16_MAX INT16_MAX
# define INT_LEAST32_MAX INT32_MAX
# define INT_LEAST64_MAX INT64_MAX
# define UINT_LEAST8_MAX UINT8_MAX
# define UINT_LEAST16_MAX UINT16_MAX
# define UINT_LEAST32_MAX UINT32_MAX
# define UINT_LEAST64_MAX UINT64_MAX

# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX

# define INTMAX_MIN INT64_MIN
# define INTMAX_MAX INT64_MAX
# define UINTMAX_MAX UINT64_MAX

# define PTRDIFF_MIN INT64_MIN
# define PTRDIFF_MAX INT64_MAX

# define SIZE_MAX UINT64_MAX

# define INT8_C(X) ((::int_least8_t)(X))
# define INT16_C(X) ((::int_least16_t)(X))
# define INT32_C(X) ((::int_least32_t)(X))
# define INT64_C(X) ((::int_least64_t)(X))
# define UINT8_C(X) ((::uint_least8_t)(X))
# define UINT16_C(X) ((::uint_least16_t)(X))
# define UINT32_C(X) ((::uint_least32_t)(X))
# define UINT64_C(X) ((::uint_least64_t)(X))

# define INTMAX_C(X) ((::intmax_t)(X))
# define UINTMAX_C(X) ((::uintmax_t)(X))
#endif // ^^^ _CCCL_COMPILER(NVRTC)

_LIBCUDACXX_BEGIN_NAMESPACE_STD

using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
using ::uint8_t;

using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;
using ::int_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;
using ::uint_fast8_t;

using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;
using ::int_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;
using ::uint_least8_t;

using ::intptr_t;
using ::uintptr_t;

using ::intmax_t;
using ::uintmax_t;

_LIBCUDACXX_END_NAMESPACE_STD

_CCCL_POP_MACROS

Expand Down
Loading
Loading