pike.git/
src/
operators.c
Branch:
Tag:
Non-build tags
All tags
No tags
2009-11-05
2009-11-05 13:48:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>
2f260d67ee6a291829ab6b1df38acf8559bfa311 (
23
lines) (+
5
/-
18
)
[
Show
|
Annotate
]
Branch:
7.9
Cleaned up cast_to_string() somewhat.
Rev: src/operators.c:1.256
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: operators.c,v 1.
255
2009/
09
/
07
16
:
46
:
05
grubba Exp $
+
|| $Id: operators.c,v 1.
256
2009/
11
/
05
13
:
48
:
55
grubba Exp $
*/ #include "global.h"
318:
we really want to reduce the number of number parsers around here. :) /Noring */ #ifdef AUTO_BIGNUM
-
+
/* The generic function is rather slow, so I added this * code for benchmark purposes. :-) /per */
-
if( sp[-1].u.string->len
<
10
&&
-
!
sp[-1].u.string->size_shift )
-
{
-
int i=atoi(sp[-1].u.string->str);
-
free_string(sp[-1].u.string);
-
sp[-1].type=T_INT;
-
sp[-1].subtype = NUMBER_NUMBER;
-
sp[-1].u.integer=i;
-
}
-
else
+
if(
(
sp[-1].u.string->len
>=
10
)
||
sp[-1].u.string->size_shift )
convert_stack_top_string_to_inumber(10);
-
return; /* FIXME: OK to return? Cast tests below indicates
-
we have to do this, at least for now... /Noring */
-
/* Yes, it is ok to return, it is actually an optimization :)
-
* /Hubbe
-
*/
+
else
#else {
-
int
i=STRTOL(sp[-1].u.string->str,0,10);
+
INT_TYPE
i
=
STRTOL(sp[-1].u.string->str,
0,
10);
free_string(sp[-1].u.string); sp[-1].type=T_INT; sp[-1].subtype = NUMBER_NUMBER;