aboutsummaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-12-01 12:20:20 +0000
committerNathan Sidwell <nathan@codesourcery.com>2005-12-01 12:20:20 +0000
commit0f3f396ba0d7d602dc2e6b3bf73f07e429286662 (patch)
tree77bed436cfc4b173dec8644258fba81df08eef57 /gcc/vec.h
parent106b1a3dce473123635e6e6c476d9c0d7222d02d (diff)
* vec.h (VEC_block_remove): New.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@107817 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/vec.h')
-rw-r--r--gcc/vec.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index 586797a6eec..93453a895ed 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -366,6 +366,15 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#define VEC_unordered_remove(T,V,I) \
(VEC_OP(T,base,unordered_remove)(VEC_BASE(V),I VEC_CHECK_INFO))
+/* Remove a block of elements
+ void VEC_T_block_remove (VEC(T) *v, unsigned ix, unsigned len);
+
+ Remove LEN elements starting at the IXth. Ordering is retained.
+ This is an O(1) operation. */
+
+#define VEC_block_remove(T,V,I,L) \
+ (VEC_OP(T,base,block_remove)(VEC_BASE(V),I,L VEC_CHECK_INFO))
+
/* Get the address of the array of elements
T *VEC_T_address (VEC(T) v)
@@ -636,6 +645,17 @@ static inline T VEC_OP (T,base,unordered_remove) \
return obj_; \
} \
\
+static inline void VEC_OP (T,base,block_remove) \
+ (VEC(T,base) *vec_, unsigned ix_, unsigned len_ VEC_CHECK_DECL) \
+{ \
+ T *slot_; \
+ \
+ VEC_ASSERT (ix_ + len_ <= vec_->num, "block_remove", T, base); \
+ slot_ = &vec_->vec[ix_]; \
+ vec_->num -= len_; \
+ memmove (slot_, slot_ + len_, (vec_->num - ix_) * sizeof (T)); \
+} \
+ \
static inline T *VEC_OP (T,base,address) \
(VEC(T,base) *vec_) \
{ \
@@ -886,6 +906,17 @@ static inline void VEC_OP (T,base,unordered_remove) \
vec_->vec[ix_] = vec_->vec[--vec_->num]; \
} \
\
+static inline void VEC_OP (T,base,block_remove) \
+ (VEC(T,base) *vec_, unsigned ix_, unsigned len_ VEC_CHECK_DECL) \
+{ \
+ T *slot_; \
+ \
+ VEC_ASSERT (ix_ + len_ <= vec_->num, "block_remove", T, base); \
+ slot_ = &vec_->vec[ix_]; \
+ vec_->num -= len_; \
+ memmove (slot_, slot_ + len_, (vec_->num - ix_) * sizeof (T)); \
+} \
+ \
static inline T *VEC_OP (T,base,address) \
(VEC(T,base) *vec_) \
{ \