ReactOS 0.4.15-dev-7907-g95bf896
witow.c File Reference
#include <precomp.h>
Include dependency graph for witow.c:

Go to the source code of this file.

Functions

wchar_t_i64tow (__int64 value, wchar_t *string, int radix)
 
wchar_t_ui64tow (unsigned __int64 value, wchar_t *string, int radix)
 

Function Documentation

◆ _i64tow()

wchar_t * _i64tow ( __int64  value,
wchar_t string,
int  radix 
)

Definition at line 19 of file witow.c.

20{
21 wchar_t tmp[65];
22 wchar_t* tp = tmp;
23 int i;
24 unsigned v;
25 int sign;
26 wchar_t* sp;
27
28 if (radix > 36 || radix <= 1) {
30 return 0;
31 }
32
33 sign = (radix == 10 && value < 0);
34 if (sign)
35 v = -value;
36 else
37 v = (unsigned)value;
38 while (v || tp == tmp) {
39 i = v % radix;
40 v = v / radix;
41 if (i < 10)
42 *tp++ = i+L'0';
43 else
44 *tp++ = i + L'a' - 10;
45 }
46
47 if (string == 0)
48 string = (wchar_t*)malloc(((tp-tmp)+sign+1)*sizeof(wchar_t));
49 sp = string;
50
51 if (sign)
52 *sp++ = L'-';
53 while (tp > tmp)
54 *sp++ = *--tp;
55 *sp = 0;
56 return string;
57}
#define malloc
Definition: debug_ros.c:4
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
#define EDOM
Definition: errno.h:39
const GLdouble * v
Definition: gl.h:2040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define sign(x)
Definition: mapdesc.cc:613
char string[160]
Definition: util.h:11
static const WCHAR sp[]
Definition: suminfo.c:287
static unsigned(__cdecl *hash_bstr)(bstr_t s)
#define L(x)
Definition: ntvdm.h:50
errno_t __cdecl _set_errno(_In_ int _Value)
Definition: pdh_main.c:94

◆ _ui64tow()

wchar_t * _ui64tow ( unsigned __int64  value,
wchar_t string,
int  radix 
)

Definition at line 62 of file witow.c.

63{
64 wchar_t tmp[65];
65 wchar_t* tp = tmp;
66 long i;
67 unsigned long v = value;
68 wchar_t* sp;
69
70 if (radix > 36 || radix <= 1) {
72 return 0;
73 }
74
75 while (v || tp == tmp) {
76 i = v % radix;
77 v = v / radix;
78 if (i < 10)
79 *tp++ = i+L'0';
80 else
81 *tp++ = i + L'a' - 10;
82 }
83
84 if (string == 0)
85 string = (wchar_t*)malloc(((tp-tmp)+1)*sizeof(wchar_t));
86 sp = string;
87
88 while (tp > tmp)
89 *sp++ = *--tp;
90 *sp = 0;
91 return string;
92}
#define wchar_t
Definition: wchar.h:102