This allows us to set the capacity of the vector when we construct it,
and still use a stack buffer when the size is small enough.
gcc/ChangeLog:
2017-05-13 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* genrecog.c (int_set::int_set): Explicitly construct our
auto_vec base class.
* vec.h (auto_vec::auto_vec): New constructor.
From-SVN: r248019
+2017-05-13 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
+ * genrecog.c (int_set::int_set): Explicitly construct our
+ auto_vec base class.
+ * vec.h (auto_vec::auto_vec): New constructor.
+
2017-05-13 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* bitmap.h (class auto_bitmap): New constructor taking
iterator end ();
};
-int_set::int_set () {}
+int_set::int_set () : auto_vec<uint64_t, 1> () {}
-int_set::int_set (uint64_t label)
+int_set::int_set (uint64_t label) :
+ auto_vec<uint64_t, 1> ()
{
safe_push (label);
}
-int_set::int_set (const int_set &other)
+int_set::int_set (const int_set &other) :
+ auto_vec<uint64_t, 1> ()
{
safe_splice (other);
}
this->m_vec = &m_auto;
}
+ auto_vec (size_t s)
+ {
+ if (s > N)
+ {
+ this->create (s);
+ return;
+ }
+
+ m_auto.embedded_init (MAX (N, 2), 0, 1);
+ this->m_vec = &m_auto;
+ }
+
~auto_vec ()
{
this->release ();