Round vector_downward initial size up (#4179)

This commit is contained in:
Sahil Jain 2017-02-15 14:42:01 -05:00 committed by Wouter van Oortmerssen
parent 1fb6b9ee6f
commit d798100be9
1 changed files with 3 additions and 4 deletions

View File

@ -496,12 +496,11 @@ class vector_downward {
public:
explicit vector_downward(size_t initial_size,
const simple_allocator &allocator)
: reserved_(initial_size),
: reserved_((initial_size + sizeof(largest_scalar_t) - 1) &
~(sizeof(largest_scalar_t) - 1)),
buf_(allocator.allocate(reserved_)),
cur_(buf_ + reserved_),
allocator_(allocator) {
assert((initial_size & (sizeof(largest_scalar_t) - 1)) == 0);
}
allocator_(allocator) {}
~vector_downward() {
if (buf_)