mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 23:04:35 +02:00
committed by
Richard Hodges
parent
0e762f1f32
commit
33ea793020
@@ -1,3 +1,4 @@
|
|||||||
|
* Remove floating point arithmetic requirement.
|
||||||
* Add `cxxstd` to json field.
|
* Add `cxxstd` to json field.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@@ -912,15 +912,17 @@ prepare(size_type n) ->
|
|||||||
destroy(reuse);
|
destroy(reuse);
|
||||||
if(n > 0)
|
if(n > 0)
|
||||||
{
|
{
|
||||||
auto const growth_factor = 2.0f;
|
std::size_t const growth_factor = 2;
|
||||||
|
std::size_t altn = in_size_ * growth_factor;
|
||||||
|
// Overflow detection:
|
||||||
|
if(in_size_ > altn)
|
||||||
|
altn = std::numeric_limits<std::size_t>::max();
|
||||||
|
else
|
||||||
|
altn = (std::max<std::size_t>)(512, altn);
|
||||||
auto const size =
|
auto const size =
|
||||||
(std::min<std::size_t>)(
|
(std::min<std::size_t>)(
|
||||||
max_ - total,
|
max_ - total,
|
||||||
(std::max<std::size_t>)({
|
(std::max<std::size_t>)(n, altn));
|
||||||
static_cast<std::size_t>(
|
|
||||||
in_size_ * growth_factor - in_size_),
|
|
||||||
512,
|
|
||||||
n}));
|
|
||||||
auto& e = alloc(size);
|
auto& e = alloc(size);
|
||||||
list_.push_back(e);
|
list_.push_back(e);
|
||||||
if(out_ == list_.end())
|
if(out_ == list_.end())
|
||||||
|
Reference in New Issue
Block a user