pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:18:   #include "cyclic.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.109 2003/09/08 15:27:57 mast Exp $"); + RCSID("$Id: array.c,v 1.110 2003/11/09 02:40:35 mast Exp $");      PMOD_EXPORT struct array empty_array=   {    1, /* Never free */   #ifdef PIKE_SECURITY    0,   #endif    &weak_empty_array, /* Next */    &weak_shrink_empty_array, /* previous (circular) */    0, /* Size = 0 */
pike.git/src/array.c:952:    return ~a;   }      INT32 set_lookup(struct array *a, struct svalue *s)   {   #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif       /* objects may have `< `> operators, evil stuff! */ -  if(s->type != T_OBJECT && !(a->flags & BIT_OBJECT)) +  if(s->type != T_OBJECT && !(a->type_field & BIT_OBJECT))    {    /* face it, it's not there */    if( (((2 << s->type) -1) & a->type_field) == 0)    return -1;       /* face it, it's not there */    if( ((BIT_MIXED << s->type) & BIT_MIXED & a->type_field) == 0)    return ~a->size;    }       return low_lookup(a,s,set_svalue_cmpfun);   }      INT32 switch_lookup(struct array *a, struct svalue *s)   {    /* face it, it's not there */   #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    /* objects may have `< `> operators, evil stuff! */ -  if(s->type != T_OBJECT && !(a->flags & BIT_OBJECT)) +  if(s->type != T_OBJECT && !(a->type_field & BIT_OBJECT))    {    if( (((2 << s->type) -1) & a->type_field) == 0)    return -1;       /* face it, it's not there */    if( ((BIT_MIXED << s->type) & BIT_MIXED & a->type_field) == 0)    return ~a->size;    }       return low_lookup(a,s,switch_svalue_cmpfun);
pike.git/src/array.c:1126:    INT32 ap,bp,i,*ret,*ptr;       ap=bp=0;   #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(a);    array_check_type_field(b);    }   #endif -  if(!(a->type_field & b->type_field)) +  if(!(a->type_field & b->type_field) && +  !((a->type_field | b->type_field) & BIT_OBJECT))    {    /* do smart optimizations */    switch(opcode)    {    case PIKE_ARRAY_OP_AND:    ret=(INT32 *)xalloc(sizeof(INT32));    *ret=0;    return ret;       case PIKE_ARRAY_OP_SUB:
pike.git/src/array.c:1512:   PMOD_EXPORT struct array *subtract_arrays(struct array *a, struct array *b)   {   #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(b);    }   #endif    check_array_for_destruct(a);    -  if(a->type_field & b->type_field) +  if((a->type_field & b->type_field) || +  ((a->type_field | b->type_field) & BIT_OBJECT))    {    return merge_array_with_order(a, b, PIKE_ARRAY_OP_SUB);    }else{    if(a->refs == 1)    {    add_ref(a);    return a;    }    return slice_array(a,0,a->size);    }
pike.git/src/array.c:1536:   PMOD_EXPORT struct array *and_arrays(struct array *a, struct array *b)   {   #ifdef PIKE_DEBUG    if(d_flag > 1)    {    array_check_type_field(b);    }   #endif    check_array_for_destruct(a);    -  if(a->type_field & b->type_field) +  if((a->type_field & b->type_field) || +  ((a->type_field | b->type_field) & BIT_OBJECT))    {    return merge_array_with_order(a, b, PIKE_ARRAY_OP_AND_LEFT);    }else{    return allocate_array_no_init(0,0);    }   }      int array_is_constant(struct array *a,    struct processing *p)   {