All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OptimalGrowth.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_POLICIES_OPTIMALGROWTH_H_
23 #define _BLAZE_UTIL_POLICIES_OPTIMALGROWTH_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 //*************************************************************************************************
53 {
54  //**Utility functions***************************************************************************
57  inline size_t operator()( size_t oldSize, size_t minSize ) const;
59  //**********************************************************************************************
60 };
61 //*************************************************************************************************
62 
63 
64 
65 
66 //=================================================================================================
67 //
68 // UTILITY FUNCTIONS
69 //
70 //=================================================================================================
71 
72 //*************************************************************************************************
79 inline size_t OptimalGrowth::operator()( size_t old, size_t minimum ) const
80 {
81  const size_t needed( max( static_cast<size_t>( old*1.5 ), minimum ) );
82  return ( ( needed )?( 4 * ( (needed-1)/4 + 1 ) ):( 0 ) );
83 }
84 //*************************************************************************************************
85 
86 } // namespace blaze
87 
88 #endif