Round vector_downward initial size up (#4179)
This commit is contained in:
parent
1fb6b9ee6f
commit
d798100be9
|
@ -496,12 +496,11 @@ class vector_downward {
|
||||||
public:
|
public:
|
||||||
explicit vector_downward(size_t initial_size,
|
explicit vector_downward(size_t initial_size,
|
||||||
const simple_allocator &allocator)
|
const simple_allocator &allocator)
|
||||||
: reserved_(initial_size),
|
: reserved_((initial_size + sizeof(largest_scalar_t) - 1) &
|
||||||
|
~(sizeof(largest_scalar_t) - 1)),
|
||||||
buf_(allocator.allocate(reserved_)),
|
buf_(allocator.allocate(reserved_)),
|
||||||
cur_(buf_ + reserved_),
|
cur_(buf_ + reserved_),
|
||||||
allocator_(allocator) {
|
allocator_(allocator) {}
|
||||||
assert((initial_size & (sizeof(largest_scalar_t) - 1)) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
~vector_downward() {
|
~vector_downward() {
|
||||||
if (buf_)
|
if (buf_)
|
||||||
|
|
Loading…
Reference in New Issue