Rcpp Version 1.0.9
longlong.h
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 //
3 // longlong.h: Rcpp R/C++ interface class library -- long long support
4 //
5 // Copyright (C) 2013 - 2017 Dirk Eddelbuettel and Romain Francois
6 // Copyright (C) 2018 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
7 //
8 // This file is part of Rcpp.
9 //
10 // Rcpp is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // Rcpp is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef RCPP_LONG_LONG_H
24 #define RCPP_LONG_LONG_H
25 
26 // long long is explicitly available to C++11 (and above) compilers
27 #if __cplusplus >= 201103L
28 
29 typedef long long int rcpp_long_long_type;
30 typedef unsigned long long int rcpp_ulong_long_type;
31 # define RCPP_HAS_LONG_LONG_TYPES
32 
33 // GNU compilers may make 'long long' available as an extension
34 // (note that __GNUC__ also implies clang, MinGW)
35 #elif defined(__GNUC__)
36 
37 // check to see if 'long long' is an alias for 'int64_t'
38 # if defined(_GLIBCXX_HAVE_INT64_T) && defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)
39 # include <stdint.h>
40 typedef int64_t rcpp_long_long_type;
41 typedef uint64_t rcpp_ulong_long_type;
42 # define RCPP_HAS_LONG_LONG_TYPES
43 
44 // check to see if this is an older C++ compiler, but extensions are enabled
45 # elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__clang__) && defined(__LP64__))
46 # if defined(__LONG_LONG_MAX__)
47 __extension__ typedef long long int rcpp_long_long_type;
48 __extension__ typedef unsigned long long int rcpp_ulong_long_type;
49 # define RCPP_HAS_LONG_LONG_TYPES
50 # endif
51 # endif
52 
53 #endif
54 
55 #endif