Thrill  0.1
types.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * foxxll/common/types.hpp
3  *
4  * Part of FOXXLL. See http://foxxll.org
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 FOXXLL_COMMON_TYPES_HEADER
15 #define FOXXLL_COMMON_TYPES_HEADER
16 
17 #include <cstddef>
18 #include <cstdint>
19 #include <type_traits>
20 
21 #include <foxxll/config.hpp>
22 
23 namespace foxxll {
24 
25 static_assert(sizeof(size_t) == 8, "FOXXLL supports only 64-bit builds");
26 
27 using external_size_type = uint64_t; // may require external memory
28 using external_diff_type = int64_t; // may require external memory
29 
30 //! Return the given value casted to the corresponding unsigned type
31 template <typename Integral>
32 typename std::make_unsigned<Integral>::type as_unsigned(Integral value)
33 {
34  return static_cast<typename std::make_unsigned<Integral>::type>(value);
35 }
36 
37 //! Return the given value casted to the corresponding signed type
38 template <typename Integral>
39 typename std::make_signed<Integral>::type as_signed(Integral value)
40 {
41  return static_cast<typename std::make_signed<Integral>::type>(value);
42 }
43 
44 } // namespace foxxll
45 
46 #endif // !FOXXLL_COMMON_TYPES_HEADER
47 
48 /**************************************************************************/
int64_t external_diff_type
Definition: types.hpp:28
int value
Definition: gen_data.py:41
FOXXLL library namespace
std::make_signed< Integral >::type as_signed(Integral value)
Return the given value casted to the corresponding signed type.
Definition: types.hpp:39
std::make_unsigned< Integral >::type as_unsigned(Integral value)
Return the given value casted to the corresponding unsigned type.
Definition: types.hpp:32
uint64_t external_size_type
Definition: types.hpp:27