ReactOS  0.4.15-dev-2996-gf777e6b
witoa.c File Reference
#include <precomp.h>
Include dependency graph for witoa.c:

Go to the source code of this file.

Functions

char_i64toa (__int64 value, char *string, int radix)
 
char_ui64toa (unsigned __int64 value, char *string, int radix)
 

Function Documentation

◆ _i64toa()

char* _i64toa ( __int64  value,
char string,
int  radix 
)

Definition at line 19 of file witoa.c.

20 {
21  ULONGLONG val;
22  int negative;
23  char buffer[65];
24  char *pos;
25  int digit;
26 
27  if (value < 0 && radix == 10) {
28  negative = 1;
29  val = -value;
30  } else {
31  negative = 0;
32  val = value;
33  } /* if */
34 
35  pos = &buffer[64];
36  *pos = '\0';
37 
38  do {
39  digit = val % radix;
40  val = val / radix;
41  if (digit < 10) {
42  *--pos = '0' + digit;
43  } else {
44  *--pos = 'a' + digit - 10;
45  } /* if */
46  } while (val != 0L);
47 
48  if (negative) {
49  *--pos = '-';
50  } /* if */
51 
52  memcpy(string, pos, &buffer[64] - pos + 1);
53  return string;
54 }
Definition: pdh_main.c:93
GLuint buffer
Definition: glext.h:5915
GLuint GLfloat * val
Definition: glext.h:7180
uint64_t ULONGLONG
Definition: typedefs.h:67
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLsizei const GLfloat * value
Definition: glext.h:6069
char string[160]
Definition: util.h:11

◆ _ui64toa()

char* _ui64toa ( unsigned __int64  value,
char string,
int  radix 
)

Definition at line 60 of file witoa.c.

61 {
62  char buffer[65];
63  char *pos;
64  int digit;
65 
66  pos = &buffer[64];
67  *pos = '\0';
68 
69  do {
70  digit = value % radix;
71  value = value / radix;
72  if (digit < 10) {
73  *--pos = '0' + digit;
74  } else {
75  *--pos = 'a' + digit - 10;
76  } /* if */
77  } while (value != 0L);
78 
79  memcpy(string, pos, &buffer[64] - pos + 1);
80  return string;
81 }
Definition: pdh_main.c:93
GLuint buffer
Definition: glext.h:5915
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char string[160]
Definition: util.h:11