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