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

Leverage libcudacxx limits and cstdint defines #16

Merged
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
69 changes: 3 additions & 66 deletions jitify2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3428,45 +3428,7 @@ JITIFY_DEFINE_C_AND_CXX_HEADERS(float, R"(
"");

JITIFY_DEFINE_C_AND_CXX_HEADERS(limits, R"(
#if defined _WIN32 || defined _WIN64
#define __WORDSIZE 32
#else
#if defined(__LP64__) || (defined __x86_64__ && !defined __ILP32__)
#define __WORDSIZE 64
#else
#define __WORDSIZE 32
#endif
#endif
#define MB_LEN_MAX 16
#define CHAR_BIT 8
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
enum {
_JITIFY_CHAR_IS_UNSIGNED = ((char)-1 >= 0),
CHAR_MIN = (_JITIFY_CHAR_IS_UNSIGNED ? 0 : SCHAR_MIN),
CHAR_MAX = (_JITIFY_CHAR_IS_UNSIGNED ? UCHAR_MAX : SCHAR_MAX),
};
#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
#if __WORDSIZE == 64
# define LONG_MAX LLONG_MAX
#else
# define LONG_MAX UINT_MAX
#endif
#define LONG_MIN (-LONG_MAX - 1)
#if __WORDSIZE == 64
#define ULONG_MAX ULLONG_MAX
#else
#define ULONG_MAX UINT_MAX
#endif
#define LLONG_MAX 0x7fffffffffffffff
#define LLONG_MIN (-LLONG_MAX - 1)
#define ULLONG_MAX 0xffffffffffffffff
#include <cuda/std/climits>
)",
"");

Expand Down Expand Up @@ -3616,27 +3578,8 @@ using ::ptrdiff_t;

JITIFY_DEFINE_C_AND_CXX_HEADERS(stdint, R"(
#include <climits>
#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 INTPTR_MIN LONG_MIN
#define INTMAX_MIN LLONG_MIN
#define INTPTR_MAX LONG_MAX
#define INTMAX_MAX LLONG_MAX
#define UINTPTR_MAX ULONG_MAX
#define UINTMAX_MAX ULLONG_MAX
#define PTRDIFF_MIN INTPTR_MIN
#define PTRDIFF_MAX INTPTR_MAX
#define SIZE_MAX UINT64_MAX
#include <cuda/std/climits>
#include <cuda/std/cstdint>
#define _JITIFY_WCHAR_T_IS_UNSIGNED ((wchar_t)-1 >= 0)
#define WCHAR_MIN \
(sizeof(wchar_t) == 2 ? _JITIFY_WCHAR_T_IS_UNSIGNED ? 0 : SHRT_MIN \
Expand All @@ -3659,7 +3602,6 @@ typedef signed short int_least16_t;
typedef signed int int_least32_t;
typedef signed long long int_least64_t;
typedef signed long long intmax_t;
typedef signed long intptr_t; // optional
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
Expand All @@ -3673,11 +3615,6 @@ typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
typedef unsigned long long uint_least64_t;
typedef unsigned long long uintmax_t;
#if defined _WIN32 || defined _WIN64
typedef unsigned long long uintptr_t; // optional
#else // not Windows
typedef unsigned long uintptr_t; // optional
#endif
)");

JITIFY_DEFINE_C_AND_CXX_HEADERS(stdio, "#include <cstddef>", R"(
Expand Down