On Fri, Feb 24, 2023 at 12:32:45PM +0100, Richard Biener via Gcc-patches wrote: > --- a/gcc/vec.h > +++ b/gcc/vec.h > @@ -614,7 +614,7 @@ public: > T *bsearch (const void *key, int (*compar)(const void *, const void *)); > T *bsearch (const void *key, > int (*compar)(const void *, const void *, void *), void *); > - unsigned lower_bound (T, bool (*)(const T &, const T &)) const; > + unsigned lower_bound (const T &, bool (*)(const T &, const T &)) const;
Missing space after (*) while you're there. > @@ -929,7 +929,7 @@ vec<T, A, vl_embed>::iterate (unsigned ix, T *ptr) const > { > if (ix < m_vecpfx.m_num) > { > - *ptr = m_vecdata[ix]; > + *ptr = address()[ix]; Missing space before (). > @@ -1118,7 +1118,7 @@ inline void > vec<T, A, vl_embed>::unordered_remove (unsigned ix) > { > gcc_checking_assert (ix < length ()); > - m_vecdata[ix] = m_vecdata[--m_vecpfx.m_num]; > + address ()[ix] = address ()[--m_vecpfx.m_num]; > } As address () is used twice here, can't we stick it into a temporary and use twice then? > @@ -1249,8 +1249,11 @@ vec<T, A, vl_embed>::contains (const T &search) const > { > unsigned int len = length (); > for (unsigned int i = 0; i < len; i++) > - if ((*this)[i] == search) > - return true; > + { > + const T *slot = &address ()[i]; > + if (*slot == search) > + return true; Similarly, can't we do address () once before the loop into a temporary? > template<typename T, typename A> > unsigned > -vec<T, A, vl_embed>::lower_bound (T obj, bool (*lessthan)(const T &, const T > &)) > +vec<T, A, vl_embed>::lower_bound (const T &obj, > + bool (*lessthan)(const T &, const T &)) ) ( while you're at it. Otherwise LGTM. Jakub