Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
round_to_power_of_two.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/math/round_to_power_of_two.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2007-2017 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_MATH_ROUND_TO_POWER_OF_TWO_HEADER
12 #define TLX_MATH_ROUND_TO_POWER_OF_TWO_HEADER
13 
14 namespace tlx {
15 
16 //! \addtogroup tlx_math
17 //! \{
18 
19 /******************************************************************************/
20 // round_up_to_power_of_two()
21 
22 //! does what it says: round up to next power of two
23 int round_up_to_power_of_two(int i);
24 
25 //! does what it says: round up to next power of two
26 unsigned int round_up_to_power_of_two(unsigned int i);
27 
28 //! does what it says: round up to next power of two
29 long round_up_to_power_of_two(long i);
30 
31 //! does what it says: round up to next power of two
32 unsigned long round_up_to_power_of_two(unsigned long i);
33 
34 //! does what it says: round up to next power of two
35 long long round_up_to_power_of_two(long long i);
36 
37 //! does what it says: round up to next power of two
38 unsigned long long round_up_to_power_of_two(unsigned long long i);
39 
40 /******************************************************************************/
41 // round_down_to_power_of_two()
42 
43 //! does what it says: round down to next power of two
45 
46 //! does what it says: round down to next power of two
47 unsigned int round_down_to_power_of_two(unsigned int i);
48 
49 //! does what it says: round down to next power of two
50 long round_down_to_power_of_two(long i);
51 
52 //! does what it says: round down to next power of two
53 unsigned long round_down_to_power_of_two(unsigned long i);
54 
55 //! does what it says: round down to next power of two
56 long long round_down_to_power_of_two(long long i);
57 
58 //! does what it says: round down to next power of two
59 unsigned long long round_down_to_power_of_two(unsigned long long i);
60 
61 //! \}
62 
63 } // namespace tlx
64 
65 #endif // !TLX_MATH_ROUND_TO_POWER_OF_TWO_HEADER
66 
67 /******************************************************************************/
int round_down_to_power_of_two(int i)
does what it says: round down to next power of two
int round_up_to_power_of_two(int i)
does what it says: round up to next power of two