LIBINT  2.1.0-stable
intrinsic_types.h
1 /*
2  * This file is a part of Libint.
3  * Copyright (C) 2004-2014 Edward F. Valeev
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Library General Public License, version 2,
7  * as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program. If not, see http://www.gnu.org/licenses/.
16  *
17  */
18 
19 #ifndef _libint2_include_libint2intrinsictypes_h_
20 #define _libint2_include_libint2intrinsictypes_h_
21 
22 #include <libint2/config.h>
23 
24 #include <limits.h>
25 
26 /* determine default LIBINT2 64-bit integer */
27 #ifdef HAVE_STDINT_H
28 
29 #include <stdint.h>
30 /* because mpz_class does not mesh with long long types, only use those when absolutely necessary */
31 #if UINT_LEAST64_MAX != ULONG_MAX
32  typedef uint_least64_t LIBINT2_UINT_LEAST64;
33 #else
34  typedef unsigned long int LIBINT2_UINT_LEAST64;
35 #endif
36 #if INT_LEAST64_MAX != LONG_MAX
37  typedef int_least64_t LIBINT2_INT_LEAST64;
38 #else
39  typedef long int LIBINT2_INT_LEAST64;
40 #endif
41 
42 #else
43 
44 #if defined(ULONGLONG_MAX) && !defined(ULLONG_MAX)
45 # define ULLONG_MAX ULONGLONG_MAX
46 #endif
47 
48 # ifdef ULLONG_MAX
49 # if ULONGLONG_MAX == (0xffffffffffffffffuLL) /* uLL reqd for xlC */
50  typedef long long LIBINT2_INT_LEAST64;
51  typedef unsigned long long LIBINT2_UINT_LEAST64;
52 # else
53 # error defaults not correct; you must hand modify libint2_intrinsic_types.h
54 # endif
55 # elif ULONG_MAX != 0xffffffff
56 
57 # if ULONG_MAX == 18446744073709551615 /* 2**64 - 1 */
58  typedef long LIBINT2_INT_LEAST64;
59  typedef unsigned long LIBINT2_UINT_LEAST64;
60 # else
61 # error defaults not correct; you must hand modify scint.h
62 # endif
63 # else /* assume no 64-bit integers */
64 # error 64 bit integer types are required
65 # endif
66 
67 #endif /* HAVE_STDINT_H */
68 
69 #endif