All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LinearGrowth.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_POLICIES_LINEARGROWTH_H_
23 #define _BLAZE_UTIL_POLICIES_LINEARGROWTH_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <blaze/math/Functions.h>
31 #include <blaze/util/Types.h>
32 
33 
34 namespace blaze {
35 
36 //=================================================================================================
37 //
38 // CLASS DEFINITION
39 //
40 //=================================================================================================
41 
42 //*************************************************************************************************
49 template< size_t Growth >
51 {
52  //**Utility functions***************************************************************************
55  inline size_t operator()( size_t oldSize, size_t minSize ) const;
57  //**********************************************************************************************
58 };
59 //*************************************************************************************************
60 
61 
62 //*************************************************************************************************
67 template<>
68 struct LinearGrowth<0>;
70 //*************************************************************************************************
71 
72 
73 //*************************************************************************************************
78 template<>
79 struct LinearGrowth<1>;
81 //*************************************************************************************************
82 
83 
84 
85 
86 //=================================================================================================
87 //
88 // UTILITY FUNCTIONS
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
99 template< size_t Growth >
100 inline size_t LinearGrowth<Growth>::operator()( size_t old, size_t minimum ) const
101 {
102  const size_t needed( max<size_t>( old*Growth, minimum ) );
103  return ( ( needed )?( 4 * ( (needed-1)/4+1 ) ):( 0 ) );
104 }
105 //*************************************************************************************************
106 
107 } // namespace blaze
108 
109 #endif