source: ThirdParty/mpqc_open/src/lib/util/misc/scint.h@ bbc982

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since bbc982 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 5.4 KB
Line 
1// This provides C99-like standard integer types. It is based on boost.org
2// code which has been modified for inclusion in the SC Toolkit.
3
4// (C) Copyright boost.org 1999. Permission to copy, use, modify, sell
5// and distribute this software is granted provided this copyright
6// notice appears in all copies. This software is provided "as is" without
7// express or implied warranty, and with no claim as to its suitability for
8// any purpose.
9
10#ifndef util_misc_scint_h
11#define util_misc_scint_h
12
13#include <scconfig.h>
14
15#ifdef HAVE_STDINT_H
16
17#include <stdint.h>
18
19namespace sc {
20
21typedef int8_t sc_int8_t;
22typedef int_least8_t sc_int_least8_t;
23typedef int_fast8_t sc_int_fast8_t;
24typedef uint8_t sc_uint8_t;
25typedef uint_least8_t sc_uint_least8_t;
26typedef uint_fast8_t sc_uint_fast8_t;
27
28typedef int16_t sc_int16_t;
29typedef int_least16_t sc_int_least16_t;
30typedef int_fast16_t sc_int_fast16_t;
31typedef uint16_t sc_uint16_t;
32typedef uint_least16_t sc_uint_least16_t;
33typedef uint_fast16_t sc_uint_fast16_t;
34
35typedef int32_t sc_int32_t;
36typedef int_least32_t sc_int_least32_t;
37typedef int_fast32_t sc_int_fast32_t;
38typedef uint32_t sc_uint32_t;
39typedef uint_least32_t sc_uint_least32_t;
40typedef uint_fast32_t sc_uint_fast32_t;
41
42typedef intmax_t sc_intmax_t;
43typedef uintmax_t sc_uintmax_t;
44typedef int64_t sc_int64_t;
45typedef int_least64_t sc_int_least64_t;
46typedef int_fast64_t sc_int_fast64_t;
47typedef uint64_t sc_uint64_t;
48typedef uint_least64_t sc_uint_least64_t;
49typedef uint_fast64_t sc_uint_fast64_t;
50
51}
52
53#else
54
55// This is not a complete implementation of the 1999 C Standard stdint.h
56// header; it doesn't supply various macros which are not advisable for use in
57// C++ programs.
58
59#include <limits.h> // implementation artifact; not part of interface
60
61namespace sc {
62
63// These are fairly safe guesses for some 16-bit, and most 32-bit and 64-bit
64// platforms. For other systems, they will have to be hand tailored.
65// Because the fast types are assumed to be the same as the undecorated types,
66// it may be possible to hand tailor a more efficient implementation.
67
68// 8-bit types -------------------------------------------------------------//
69
70# if UCHAR_MAX == 0xff
71 typedef signed char sc_int8_t;
72 typedef signed char sc_int_least8_t;
73 typedef signed char sc_int_fast8_t;
74 typedef unsigned char sc_uint8_t;
75 typedef unsigned char sc_uint_least8_t;
76 typedef unsigned char sc_uint_fast8_t;
77# else
78# error defaults not correct; you must hand modify scint.h
79# endif
80
81// 16-bit types ------------------------------------------------------------//
82
83# if USHRT_MAX == 0xffff
84 typedef short sc_int16_t;
85 typedef short sc_int_least16_t;
86 typedef short sc_int_fast16_t;
87 typedef unsigned short sc_uint16_t;
88 typedef unsigned short sc_uint_least16_t;
89 typedef unsigned short sc_uint_fast16_t;
90# else
91# error defaults not correct; you must hand modify scint.h
92# endif
93
94// 32-bit types ------------------------------------------------------------//
95
96# if UINT_MAX == 0xffffffff
97 typedef int sc_int32_t;
98 typedef int sc_int_least32_t;
99 typedef int sc_int_fast32_t;
100 typedef unsigned int sc_uint32_t;
101 typedef unsigned int sc_uint_least32_t;
102 typedef unsigned int sc_uint_fast32_t;
103# elif ULONG_MAX == 0xffffffff
104 typedef long sc_int32_t;
105 typedef long sc_int_least32_t;
106 typedef long sc_int_fast32_t;
107 typedef unsigned long sc_uint32_t;
108 typedef unsigned long sc_uint_least32_t;
109 typedef unsigned long sc_uint_fast32_t;
110# else
111# error defaults not correct; you must hand modify scint.h
112# endif
113
114// 64-bit types + intmax_t and uintmax_t -----------------------------------//
115
116#if defined(ULONGLONG_MAX) && !defined(ULLONG_MAX)
117# define ULLONG_MAX ULONGLONG_MAX
118#endif
119
120# ifdef ULLONG_MAX
121//# if ULLONG_MAX == 18446744073709551615 // 2**64 - 1
122# if ULONGLONG_MAX == (0xffffffffffffffffuLL) // uLL reqd for xlC
123 typedef long long sc_intmax_t;
124 typedef unsigned long long sc_uintmax_t;
125 typedef long long sc_int64_t;
126 typedef long long sc_int_least64_t;
127 typedef long long sc_int_fast64_t;
128 typedef unsigned long long sc_uint64_t;
129 typedef unsigned long long sc_uint_least64_t;
130 typedef unsigned long long sc_uint_fast64_t;
131# else
132# error defaults not correct; you must hand modify scint.h
133# endif
134# elif ULONG_MAX != 0xffffffff
135
136# if ULONG_MAX == 18446744073709551615 // 2**64 - 1
137 typedef long sc_intmax_t;
138 typedef unsigned long sc_uintmax_t;
139 typedef long sc_int64_t;
140 typedef long sc_int_least64_t;
141 typedef long sc_int_fast64_t;
142 typedef unsigned long sc_uint64_t;
143 typedef unsigned long sc_uint_least64_t;
144 typedef unsigned long sc_uint_fast64_t;
145# else
146# error defaults not correct; you must hand modify scint.h
147# endif
148# else // assume no 64-bit integers
149# error 64 bit integer types are required
150 typedef sc_int32_t sc_intmax_t;
151 typedef sc_uint32_t sc_uintmax_t;
152# endif
153
154}
155
156#endif
157
158#endif
Note: See TracBrowser for help on using the repository browser.