pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1:
/* -*- c -*- || 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: builtin.cmod,v 1.
154
2004/04/
18
02
:
17
:
44
mast
Exp $
+
|| $Id: builtin.cmod,v 1.
155
2004/04/
25
19
:
47
:
36
nilsson
Exp $
*/ #include "global.h" #include "interpret.h" #include "svalue.h" #include "pike_macros.h" #include "object.h" #include "program.h" #include "array.h" #include "pike_error.h"
pike.git/src/builtin.cmod:177:
struct string_builder tmp; init_string_builder(&tmp,0); string_builder_putchar(&tmp, c); RETURN finish_string_builder(&tmp); } } /*! @decl string int2hex(int x) *! @appears String.int2hex *!
-
*! Same as
sprintf
("%x",x);
+
*! Same as
@expr{sprintf
("%x",x);
@}, i.e. writes out the integer @[x]
+
*! in hexadecimal base using lower case.
*! *! @seealso *! @[sprintf()] */ PIKEFUN string int2hex(int|object x) efun; optflags OPT_TRY_OPTIMIZE; { INT_TYPE c; unsigned INT_TYPE n;
pike.git/src/builtin.cmod:224:
if(c<0) { len++; n=(-c)&((unsigned INT_TYPE)(-1)); }else{ n=c; } while(n>65535) { n>>=16; len+=4; } while(n>15) { n>>=4; len++; } s=begin_shared_string(len);
-
c=x->u.integer;
+
if(!c) { s->str[0]='0'; }else{ if(c<0) { s->str[0]='-'; n=(-c)&((unsigned INT_TYPE)(-1)); }else{ n=c;