Branch: Tag:

2008-08-24

2008-08-24 21:32:00 by Stephen R. van den Berg <srb@cuci.nl>

Revert: fix overflow bug when casting float to string.
Revert: Optimise optimisation and move inline int2string
from roxen.c to operators.c.

Rev: src/modules/_Roxen/roxen.c:1.53
Rev: src/operators.c:1.240

2:   || 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: roxen.c,v 1.52 2008/08/22 14:13:20 srb Exp $ + || $Id: roxen.c,v 1.53 2008/08/24 21:32:00 srb Exp $   */      #define NO_PIKE_SHORTHAND
456:    void o_cast_to_string();       case PIKE_T_INT: +  /* Optimization, this is basically a inlined cast_int_to_string */ +  { +  char buf[21], *b = buf+19; +  int neg, i, j=0; +  i = Pike_sp[-1].u.integer; +  pop_stack(); +  if( i < 0 ) +  { +  neg = 1; +  i = -i; +  } +  else +  neg = 0; +  +  buf[20] = 0; +  +  while( i >= 10 ) +  { +  b[ -j++ ] = '0'+(i%10); +  i /= 10; +  } +  b[ -j++ ] = '0'+(i%10); +  if( neg ) b[ -j++ ] = '-'; +  push_text( b-j+1 ); +  } +  return; +     case PIKE_T_FLOAT:    /* Optimization, no need to check the resultstring for    * unsafe characters.