Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-07-05 16:08:26 +0300
committerJacques Lucke <jacques@blender.org>2020-07-05 16:08:26 +0300
commit247a28f242c2c0a8931a84df0db6e60763642f30 (patch)
treecdd5721ab333967a5b4e0489ded5f29bf48610b4 /source/blender/blenlib/BLI_vector.hh
parent5d79f9f276b4b3e6289308c534c58e7ee3bb5e2d (diff)
Revert "BLI: refactor how buffers for small object optimization are stored"
This reverts commit 5d79f9f276b4b3e6289308c534c58e7ee3bb5e2d. This was introducing build errors in windows. Need a bit more time to check it.
Diffstat (limited to 'source/blender/blenlib/BLI_vector.hh')
-rw-r--r--source/blender/blenlib/BLI_vector.hh19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh
index e4f5afe661d..a06be65685f 100644
--- a/source/blender/blenlib/BLI_vector.hh
+++ b/source/blender/blenlib/BLI_vector.hh
@@ -92,7 +92,7 @@ class Vector {
Allocator allocator_;
/** A placeholder buffer that will remain uninitialized until it is used. */
- TypedBuffer<T, InlineBufferCapacity> inline_buffer_;
+ AlignedBuffer<(uint)sizeof(T) * InlineBufferCapacity, (uint)alignof(T)> inline_buffer_;
/**
* Store the size of the vector explicitly in debug builds. Otherwise you'd always have to call
@@ -120,7 +120,7 @@ class Vector {
*/
Vector()
{
- begin_ = inline_buffer_;
+ begin_ = this->inline_buffer();
end_ = begin_;
capacity_end_ = begin_ + InlineBufferCapacity;
UPDATE_VECTOR_SIZE(this);
@@ -227,7 +227,7 @@ class Vector {
if (other.is_inline()) {
if (size <= InlineBufferCapacity) {
/* Copy between inline buffers. */
- begin_ = inline_buffer_;
+ begin_ = this->inline_buffer();
end_ = begin_ + size;
capacity_end_ = begin_ + InlineBufferCapacity;
uninitialized_relocate_n(other.begin_, size, begin_);
@@ -248,7 +248,7 @@ class Vector {
capacity_end_ = other.capacity_end_;
}
- other.begin_ = other.inline_buffer_;
+ other.begin_ = other.inline_buffer();
other.end_ = other.begin_;
other.capacity_end_ = other.begin_ + OtherInlineBufferCapacity;
UPDATE_VECTOR_SIZE(this);
@@ -399,7 +399,7 @@ class Vector {
allocator_.deallocate(begin_);
}
- begin_ = inline_buffer_;
+ begin_ = this->inline_buffer();
end_ = begin_;
capacity_end_ = begin_ + InlineBufferCapacity;
UPDATE_VECTOR_SIZE(this);
@@ -763,9 +763,14 @@ class Vector {
}
private:
+ T *inline_buffer() const
+ {
+ return (T *)inline_buffer_.ptr();
+ }
+
bool is_inline() const
{
- return begin_ == inline_buffer_;
+ return begin_ == this->inline_buffer();
}
void ensure_space_for_one()
@@ -812,7 +817,7 @@ class Vector {
uint capacity;
if (size <= InlineBufferCapacity) {
- begin_ = inline_buffer_;
+ begin_ = this->inline_buffer();
capacity = InlineBufferCapacity;
}
else {