pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.135 2003/09/08 15:28:14 mast Exp $ + || $Id: array.c,v 1.136 2003/11/09 02:40:42 mast Exp $   */      #include "global.h"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h"
pike.git/src/array.c:18:   #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"   #include "cyclic.h"    - RCSID("$Id: array.c,v 1.135 2003/09/08 15:28:14 mast Exp $"); + RCSID("$Id: array.c,v 1.136 2003/11/09 02:40:42 mast Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    &weak_shrink_empty_array, /* previous (circular) */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:946:    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:1120:    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:1551:   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:1575:   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)   {