Commit d798100b authored by Sahil Jain's avatar Sahil Jain Committed by Wouter van Oortmerssen

Round vector_downward initial size up (#4179)

parent 1fb6b9ee
...@@ -496,12 +496,11 @@ class vector_downward { ...@@ -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_)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment