diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-11-14 16:58:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-11-14 16:58:13 +0900 |
commit | 49f495ff20f3c7e1a0af68be6c147a0e1b907740 (patch) | |
tree | 7c711b8a9ccbf66a2da3bfcd0085b06e13d2c638 /boost/pool | |
parent | 2212a42dc9bc8e6fea9d1dfaf7d2325c3a82b6ab (diff) | |
download | boost-49f495ff20f3c7e1a0af68be6c147a0e1b907740.tar.gz boost-49f495ff20f3c7e1a0af68be6c147a0e1b907740.tar.bz2 boost-49f495ff20f3c7e1a0af68be6c147a0e1b907740.zip |
Bump to Boost 1.62.0
[Model] ALL
[BinType] AP
[Customer] OPEN
[Issue#] N/A
[Request] N/A
[Occurrence Version] N/A
[Problem] Bump to Boost 1.62.0
[Cause & Measure] Bump to Boost 1.62.0
[Checking Method] N/A
[Team] Open Source Management and Setting Part
[Developer] dh0128.kwak
[Solution company] Samsung
[Change Type] N/A
Change-Id: I97a9168bfa467f74b8345b20b78175157f7676b0
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/pool')
-rw-r--r-- | boost/pool/pool.hpp | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/boost/pool/pool.hpp b/boost/pool/pool.hpp index c230077da9..c47b11faf2 100644 --- a/boost/pool/pool.hpp +++ b/boost/pool/pool.hpp @@ -26,10 +26,8 @@ #include <boost/pool/poolfwd.hpp> -// std::numeric_limits -#include <boost/limits.hpp> -// boost::math::static_lcm -#include <boost/math/common_factor_ct.hpp> +// boost::integer::static_lcm +#include <boost/integer/common_factor_ct.hpp> // boost::simple_segregated_storage #include <boost/pool/simple_segregated_storage.hpp> // boost::alignment_of @@ -357,15 +355,6 @@ class pool: protected simple_segregated_storage < typename UserAllocator::size_t return s; } - size_type max_chunks() const - { //! Calculated maximum number of memory chunks that can be allocated in a single call by this Pool. - size_type partition_size = alloc_size(); - size_type POD_size = integer::static_lcm<sizeof(size_type), sizeof(void *)>::value + sizeof(size_type); - size_type max_chunks = (std::numeric_limits<size_type>::max() - POD_size) / alloc_size(); - - return max_chunks; - } - static void * & nextof(void * const ptr) { //! \returns Pointer dereferenced. //! (Provided and used for the sake of code readability :) @@ -386,8 +375,6 @@ class pool: protected simple_segregated_storage < typename UserAllocator::size_t //! the first time that object needs to allocate system memory. //! The default is 32. This parameter may not be 0. //! \param nmax_size is the maximum number of chunks to allocate in one block. - set_next_size(nnext_size); - set_max_size(nmax_size); } ~pool() @@ -411,8 +398,8 @@ class pool: protected simple_segregated_storage < typename UserAllocator::size_t } void set_next_size(const size_type nnext_size) { //! Set number of chunks to request from the system the next time that object needs to allocate system memory. This value should never be set to 0. - BOOST_USING_STD_MIN(); - next_size = start_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(nnext_size, max_chunks()); + //! \returns nnext_size. + next_size = start_size = nnext_size; } size_type get_max_size() const { //! \returns max_size. @@ -420,8 +407,7 @@ class pool: protected simple_segregated_storage < typename UserAllocator::size_t } void set_max_size(const size_type nmax_size) { //! Set max_size. - BOOST_USING_STD_MIN(); - max_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(nmax_size, max_chunks()); + max_size = nmax_size; } size_type get_requested_size() const { //! \returns the requested size passed into the constructor. @@ -722,9 +708,9 @@ void * pool<UserAllocator>::malloc_need_resize() BOOST_USING_STD_MIN(); if(!max_size) - set_next_size(next_size << 1); - else if(next_size < max_size * requested_size / partition_size) - set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size)); + next_size <<= 1; + else if( next_size*partition_size/requested_size < max_size) + next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size); // initialize it, store().add_block(node.begin(), node.element_size(), partition_size); @@ -762,9 +748,9 @@ void * pool<UserAllocator>::ordered_malloc_need_resize() BOOST_USING_STD_MIN(); if(!max_size) - set_next_size(next_size << 1); - else if(next_size < max_size * requested_size / partition_size) - set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size)); + next_size <<= 1; + else if( next_size*partition_size/requested_size < max_size) + next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size); // initialize it, // (we can use "add_block" here because we know that @@ -806,8 +792,6 @@ void * pool<UserAllocator>::ordered_malloc(const size_type n) { //! Gets address of a chunk n, allocating new memory if not already available. //! \returns Address of chunk n if allocated ok. //! \returns 0 if not enough memory for n chunks. - if (n > max_chunks()) - return 0; const size_type partition_size = alloc_size(); const size_type total_req_size = n * requested_size; @@ -856,9 +840,9 @@ void * pool<UserAllocator>::ordered_malloc(const size_type n) BOOST_USING_STD_MIN(); if(!max_size) - set_next_size(next_size << 1); - else if(next_size < max_size * requested_size / partition_size) - set_next_size(min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size * requested_size / partition_size)); + next_size <<= 1; + else if( next_size*partition_size/requested_size < max_size) + next_size = min BOOST_PREVENT_MACRO_SUBSTITUTION(next_size << 1, max_size*requested_size/ partition_size); // insert it into the list, // handle border case. |