예제 #1
0
void @TYPE@_vector_rshift(@TYPE@_vector_type * vector , int shift) {
  if (shift < 0)
    @TYPE@_vector_memmove( vector , -shift , shift);
  else {
    int i;
    @TYPE@_vector_memmove( vector , 0 , shift);
    for (i=0; i < shift; i++)
      vector->data[i] = vector->default_value;
  }
}
예제 #2
0
void @TYPE@_vector_insert( @TYPE@_vector_type * vector , int index , @TYPE@ value) {
  if (index >= vector->size)
    @TYPE@_vector_iset( vector , index , value );
  else {
    @TYPE@_vector_memmove( vector , index , 1 );
    @TYPE@_vector_iset( vector , index , value );
  }
}
예제 #3
0
void @TYPE@_vector_idel_block( @TYPE@_vector_type * vector , int index , int block_size) {
  @TYPE@_vector_assert_writable( vector ); 
  {
    if ((index >= 0) && (index < vector->size) && (block_size >= 0)) {
      if (index + block_size > vector->size)
        block_size = vector->size - index;
      
      index += block_size;
      @TYPE@_vector_memmove( vector , index , -block_size );
    } else
      util_abort("%s: invalid input \n",__func__);
  }
}