386 |
memcpy(p, day_tab + t->tm_wday * 4, 4); |
memcpy(p, day_tab + t->tm_wday * 4, 4); |
387 |
} |
} |
388 |
|
|
389 |
/* Returns the number of digits */ |
/* Converts an integer to a string and |
390 |
|
* returns the number of digits. Does not accept negative |
391 |
|
* values. |
392 |
|
*/ |
393 |
int simple_itoa(large_int i, char buf[22]) |
int simple_itoa(large_int i, char buf[22]) |
394 |
{ |
{ |
395 |
/* 21 digits plus null terminator, good for 64-bit or smaller ints |
/* 21 digits plus null terminator, good for 64-bit or smaller ints |
400 |
*/ |
*/ |
401 |
char *p = &buf[21]; |
char *p = &buf[21]; |
402 |
int digits = 1; /* include null char */ |
int digits = 1; /* include null char */ |
403 |
|
|
404 |
|
if ( i < 0) { |
405 |
|
buf[0] = 0; |
406 |
|
return 0; |
407 |
|
} |
408 |
|
|
409 |
*p-- = '\0'; |
*p-- = '\0'; |
410 |
do { |
do { |