pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:3821:       case TWO_TYPES(T_ARRAY, T_INT):    {    struct array *a;    ptrdiff_t size,e,pos;       INT_TYPE len=sp[-1].u.integer;    if(!len)    OP_DIVISION_BY_ZERO_ERROR("`/");    +  if (!Pike_sp[-2].u.array->size) { +  pop_n_elems (2); +  ref_push_array (&empty_array); +  return; +  } +     if(len<0)    {    len = -len;    pos = sp[-2].u.array->size % len;    }else{    pos = 0;    }    size = sp[-2].u.array->size / len;       a=allocate_array(size);
pike.git/src/operators.c:3855:    case TWO_TYPES(T_ARRAY,T_FLOAT):    {    struct array *a;    ptrdiff_t last,pos,e,size;    FLOAT_ARG_TYPE len;       len=sp[-1].u.float_number;    if(len==0.0)    OP_DIVISION_BY_ZERO_ERROR("`/");    +  if (!Pike_sp[-2].u.array->size) { +  pop_n_elems (2); +  ref_push_array (&empty_array); +  return; +  } +     if(len<0)    {    len=-len;    size = (ptrdiff_t)ceil( ((double)sp[-2].u.array->size) / len);    a=allocate_array(size);       for(last=sp[-2].u.array->size,e=0;e<size-1;e++)    {    pos=sp[-2].u.array->size - (ptrdiff_t)((e+1)*len+0.5);    a->item[size-1-e].u.array=friendly_slice_array(sp[-2].u.array,