pike.git / src / opcodes.c

version» Context lines:

pike.git/src/opcodes.c:15:   #include "opcodes.h"   #include "object.h"   #include "error.h"   #include "pike_types.h"   #include "pike_memory.h"   #include "fd_control.h"   #include "cyclic.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "security.h" + #include "bignum.h"    - RCSID("$Id: opcodes.c,v 1.43 1999/08/21 23:21:07 noring Exp $"); + RCSID("$Id: opcodes.c,v 1.44 1999/10/19 22:21:30 noring Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {    INT32 i;      #ifdef PIKE_SECURITY    if(what->type <= MAX_COMPLEX)    if(!CHECK_DATA_SECURITY(what->u.array, SECURITY_BIT_INDEX))    error("Index permission denied.\n");   #endif       switch(what->type)    { -  + #ifdef AUTO_BIGNUM +  case T_INT: +  convert_svalue_to_bignum(what); +  index_no_free(to, what, ind); +  break; + #endif /* AUTO_BIGNUM */ +     case T_ARRAY:    simple_array_index_no_free(to,what->u.array,ind);    break;       case T_MAPPING:    mapping_index_no_free(to,what->u.mapping,ind);    break;       case T_OBJECT:    object_index_no_free(to, what->u.object, ind);
pike.git/src/opcodes.c:179:    error("Cannot cast %s to array.\n",get_name_of_type(sp[-1].type));       }    break;       case T_INT:    switch(sp[-1].type)    {    case T_FLOAT:    i=(int)(sp[-1].u.float_number); + #ifdef AUTO_BIGNUM +  if((i < 0 ? -i : i) < fabs(floor(sp[-1].u.float_number))) +  { +  /* Note: This includes the case when i = 0x80000000, i.e. +  the absolute value is not computable. */ +  convert_stack_top_to_bignum(); +  return; +  } + #endif /* AUTO_BIGNUM */    break;       case T_STRING:    i=STRTOL(sp[-1].u.string->str,0,10);    free_string(sp[-1].u.string);    break;       default:    error("Cannot cast %s to int.\n",get_name_of_type(sp[-1].type));    }