summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-01-13 12:57:41 -0800
committerGitHub <noreply@github.com>2022-01-13 12:57:41 -0800
commit6d92ba9ceb14563fb4d1e573f8644eb06a8cea2a (patch)
treebe2f0163eabae3c0506854b9aa7f65332e4599c5 /src/support
parent3168fa227eeb3b964b6d3c773d95e0a2014b396a (diff)
downloadbinaryen-6d92ba9ceb14563fb4d1e573f8644eb06a8cea2a.tar.gz
binaryen-6d92ba9ceb14563fb4d1e573f8644eb06a8cea2a.tar.bz2
binaryen-6d92ba9ceb14563fb4d1e573f8644eb06a8cea2a.zip
LiteralList => Literals (#4451)
LiteralList overlaps with Literals, but is less efficient as it is not a SmallVector. Add reserve/capacity methods to SmallVector which are now necessary to compile.
Diffstat (limited to 'src/support')
-rw-r--r--src/support/small_vector.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/support/small_vector.h b/src/support/small_vector.h
index 8ab10c05b..e2c865b8f 100644
--- a/src/support/small_vector.h
+++ b/src/support/small_vector.h
@@ -119,6 +119,14 @@ public:
}
}
+ void reserve(size_t reservedSize) {
+ if (reservedSize > N) {
+ flexible.reserve(reservedSize - N);
+ }
+ }
+
+ size_t capacity() const { return N + flexible.capacity(); }
+
bool operator==(const SmallVector<T, N>& other) const {
if (usedFixed != other.usedFixed) {
return false;