16 #include <my_global.h>
22 char _dig_vec_upper[] =
23 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
24 char _dig_vec_lower[] =
25 "0123456789abcdefghijklmnopqrstuvwxyz";
53 int2str(
register long int val,
register char *dst,
register int radix,
59 char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower;
60 ulong uval= (ulong) val;
64 if (radix < -36 || radix > -2)
70 uval = (ulong)0 - uval;
74 else if (radix > 36 || radix < 2)
89 p = &buffer[
sizeof(buffer)-1];
91 new_val= uval / (ulong) radix;
92 *--p = dig_vec[(uchar) (uval- (ulong) new_val*(ulong) radix)];
99 *--p = dig_vec[res.rem];
106 *--p = dig_vec[(uchar) (val-new_val*radix)];
110 while ((*dst++ = *p++) != 0) ;
133 char *int10_to_str(
long int val,
char *dst,
int radix)
138 unsigned long int uval = (
unsigned long int) val;
146 uval = (
unsigned long int)0 - uval;
150 p = &buffer[
sizeof(buffer)-1];
152 new_val= (long) (uval / 10);
153 *--p =
'0'+ (char) (uval - (
unsigned long) new_val * 10);
159 *--p =
'0' + (char) (val-new_val*10);
162 while ((*dst++ = *p++) != 0) ;