Stxxl  1.3.2
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 <[email protected]>
7  * Copyright (C) 2010 Andreas Beckmann <[email protected]>
8  *
9  * Distributed under the Boost Software License, Version 1.0.
10  * (See accompanying file LICENSE_1_0.txt or copy at
11  * http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 #ifndef STXXL_TYPES_HEADER
15 #define STXXL_TYPES_HEADER
16 
17 #ifdef STXXL_BOOST_CONFIG
18  #include <boost/config.hpp>
19 #endif
20 
21 #include <stxxl/bits/namespace.h>
22 
23 
24 __STXXL_BEGIN_NAMESPACE
25 
26 
27 #ifdef STXXL_BOOST_CONFIG
28  #ifdef BOOST_MSVC
29 typedef __int64 int64;
30 typedef unsigned __int64 uint64;
31  #else
32 typedef long long int int64;
33 typedef unsigned long long int uint64;
34  #endif
35 #else
36 typedef long long int int64;
37 typedef unsigned long long int uint64;
38 #endif
39 
40 
41 // integer types declarations
42 enum { my_pointer_size = sizeof(void *) };
43 
44 template <int PtrSize>
45 struct choose_int_types
46 { };
47 
48 template <>
49 struct choose_int_types<4> // for 32-bit processors/compilers
50 {
51  typedef int int_type;
52  typedef unsigned unsigned_type;
53 };
54 
55 template <>
56 struct choose_int_types<8> // for 64-bit processors/compilers
57 {
58  typedef int64 int_type;
59  typedef uint64 unsigned_type;
60 };
61 
62 typedef choose_int_types<my_pointer_size>::int_type int_type;
63 typedef choose_int_types<my_pointer_size>::unsigned_type unsigned_type;
64 
65 typedef unsigned_type internal_size_type; // fits in internal memory
66 typedef uint64 external_size_type; // may require external memory
67 
68 __STXXL_END_NAMESPACE
69 
70 #endif // !STXXL_TYPES_HEADER