Branch: Tag:

2002-04-20

2002-04-20 15:07:39 by Johan Sundström <oyasumi@gmail.com>

Autodoc spellfix.

Rev: src/operators.c:1.147

6:   /**/   #include "global.h"   #include <math.h> - RCSID("$Id: operators.c,v 1.146 2002/04/20 14:56:14 jhs Exp $"); + RCSID("$Id: operators.c,v 1.147 2002/04/20 15:07:39 jhs Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"
2016:      PMOD_EXPORT void o_rsh(void)   { -  if(sp[-2].type == T_STRING) /* s[..sizeof(s)-n-1] */ +  switch(sp[-2].type)    { -  +  case T_ARRAY: /* s[..sizeof(s)-n-1] */ +  { +  struct array *a; +  if(to >= sp[-1].u.array->size-1) +  { +  to = sp[-1].u.array->size-1; +  +  if(from>to+1) from=to+1; +  } +  +  a = slice_array(sp[-1].u.array, from, to+1); +  free_array(sp[-1].u.array); +  sp[-1].u.array=a; +  break; +  } +  +  case T_STRING: /* s[..sizeof(s)-n-1] */ +  {    struct pike_string *s;    ptrdiff_t len;    int args = 2;
2042:    return;    }    -  if(sp[-2].type != T_INT || sp[-1].type != T_INT) +  case T_INT:    { -  int args = 2; -  if(call_lfun(LFUN_RSH, LFUN_RRSH)) -  return; -  if(sp[-2].type != T_INT) -  SIMPLE_BAD_ARG_ERROR("`>>", 1, "int|string|object"); -  SIMPLE_BAD_ARG_ERROR("`>>", 2, "int|object"); -  } -  +    #ifdef AUTO_BIGNUM    if(INT_TYPE_RSH_OVERFLOW(sp[-2].u.integer, sp[-1].u.integer))    {
2073:       sp--;    sp[-1].u.integer = sp[-1].u.integer >> sp->u.integer; +  return;    } -  +  } +  if(sp[-1].type != T_INT || sp[-2].type != T_INT) +  { +  int args = 2; +  if(call_lfun(LFUN_RSH, LFUN_RRSH)) +  return; +  if(sp[-2].type != T_INT) +  SIMPLE_BAD_ARG_ERROR("`>>", 1, "int|string|object"); +  SIMPLE_BAD_ARG_ERROR("`>>", 2, "int|object"); +  } + }      /*! @decl int `>>(int arg1, int arg2)    *! @decl mixed `>>(object arg1, int|object arg2)
2091:    *! If @[arg1] is a string, it will be truncated @[arg2] characters    *! from the right ("Hi!" >> 2 == "Hi!"[..sizeof("Hi!")-3] == "H").    *! -  *! Otherwise @[arg1] will be shifted @[arg2] bits left. +  *! Otherwise @[arg1] will be shifted @[arg2] bits right.    *!    *! @seealso    *! @[`<<()]