|
22 | 22 | #ifndef RCPP_LONG_LONG_H
|
23 | 23 | #define RCPP_LONG_LONG_H
|
24 | 24 |
|
25 |
| -// 'long long' is a C99 extension and (as of fall 2013) still |
26 |
| -// forbidden by CRAN which stick with the C++98 standard predating it. |
27 |
| -// One way to get 'long long' is to switch to C++11, another is to use |
28 |
| -// clang++ from the llvm project. |
29 |
| -#ifdef __GNUC__ |
30 |
| -#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined (__clang__) && defined(__LP64__)) |
31 |
| - |
32 |
| -#if defined(__GNUC__) && defined(__LONG_LONG_MAX__) |
| 25 | +// long long is explicitly available to C++11 (and above) compilers |
| 26 | +#if __cplusplus >= 201103L |
| 27 | + |
| 28 | +typedef long long int rcpp_long_long_type; |
| 29 | +typedef unsigned long long int rcpp_ulong_long_type; |
| 30 | +# define RCPP_HAS_LONG_LONG_TYPES |
| 31 | + |
| 32 | +// GNU compilers may make 'long long' available as an extension |
| 33 | +// (note that __GNUC__ also implies clang, MinGW) |
| 34 | +#elif defined(__GNUC__) |
| 35 | + |
| 36 | +// check to see if 'long long' is an alias for 'int64_t' |
| 37 | +# if defined(_GLIBCXX_HAVE_INT64_T) && defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG) |
| 38 | +# include <stdint.h> |
| 39 | +typedef int64_t rcpp_long_long_type; |
| 40 | +typedef uint64_t rcpp_ulong_long_type; |
| 41 | +# define RCPP_HAS_LONG_LONG_TYPES |
| 42 | + |
| 43 | +// check to see if this is an older C++ compiler, but extensions are enabled |
| 44 | +# elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__clang__) && defined(__LP64__)) |
| 45 | +# if defined(__LONG_LONG_MAX__) |
33 | 46 | __extension__ typedef long long int rcpp_long_long_type;
|
34 | 47 | __extension__ typedef unsigned long long int rcpp_ulong_long_type;
|
35 |
| -#define RCPP_HAS_LONG_LONG_TYPES |
36 |
| -#endif |
37 |
| - |
38 |
| -#endif |
39 |
| -#endif |
| 48 | +# define RCPP_HAS_LONG_LONG_TYPES |
| 49 | +# endif |
| 50 | +# endif |
40 | 51 |
|
41 |
| -// The Rtools toolchain provides long long on 64bit Windows |
42 |
| -#ifdef _WIN64 |
43 |
| -typedef long long rcpp_long_long_type; |
44 |
| -typedef unsigned long long rcpp_ulong_long_type; |
45 |
| -#define RCPP_HAS_LONG_LONG_TYPES |
46 | 52 | #endif
|
47 | 53 |
|
48 | 54 | #endif
|
0 commit comments