Stxxl  1.2.1
types.h
1 /***************************************************************************
2  * include/stxxl/bits/common/types.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2007 Roman Dementiev <dementiev@ira.uka.de>
7  *
8  * Distributed under the Boost Software License, Version 1.0.
9  * (See accompanying file LICENSE_1_0.txt or copy at
10  * http://www.boost.org/LICENSE_1_0.txt)
11  **************************************************************************/
12 
13 #ifndef STXXL_TYPES_HEADER
14 #define STXXL_TYPES_HEADER
15 
16 #ifdef STXXL_BOOST_CONFIG
17  #include <boost/config.hpp>
18 #endif
19 
20 #include <stxxl/bits/namespace.h>
21 
22 
23 __STXXL_BEGIN_NAMESPACE
24 
25 
26 #ifdef STXXL_BOOST_CONFIG
27  #ifdef BOOST_MSVC
28 typedef __int64 int64;
29 typedef unsigned __int64 uint64;
30  #else
31 typedef long long int int64;
32 typedef unsigned long long uint64;
33  #endif
34 #else
35 typedef long long int int64;
36 typedef unsigned long long uint64;
37 #endif
38 
39 
40 // integer types declarations
41 enum { my_pointer_size = sizeof(void *) };
42 
43 template <int PtrSize>
44 struct choose_int_types
45 { };
46 
47 template <>
48 struct choose_int_types<4> // for 32-bit processors/compilers
49 {
50  typedef int int_type;
51  typedef unsigned unsigned_type;
52 };
53 
54 template <>
55 struct choose_int_types<8> // for 64-bit processors/compilers
56 {
57  typedef long long int int_type;
58  typedef long long unsigned unsigned_type;
59 };
60 
61 typedef choose_int_types<my_pointer_size>::int_type int_type;
62 typedef choose_int_types<my_pointer_size>::unsigned_type unsigned_type;
63 
64 __STXXL_END_NAMESPACE
65 
66 #endif // !STXXL_TYPES_HEADER