41 #include <my_global.h>
50 char *ll2str(longlong val,
char *dst,
int radix,
int upcase)
55 char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower;
56 ulonglong uval= (ulonglong) val;
60 if (radix < -36 || radix > -2)
return (
char*) 0;
64 uval = (ulonglong)0 - uval;
70 if (radix > 36 || radix < 2)
return (
char*) 0;
78 p = &buffer[
sizeof(buffer)-1];
81 while (uval > (ulonglong) LONG_MAX)
83 ulonglong quo= uval/(uint) radix;
84 uint rem= (uint) (uval- quo* (uint) radix);
88 long_val= (long) uval;
91 long quo= long_val/radix;
92 *--p= dig_vec[(uchar) (long_val - quo*radix)];
95 while ((*dst++ = *p++) != 0) ;
100 #ifndef longlong10_to_str
101 char *longlong10_to_str(longlong val,
char *dst,
int radix)
106 ulonglong uval= (ulonglong) val;
114 uval = (ulonglong)0 - uval;
124 p = &buffer[
sizeof(buffer)-1];
127 while (uval > (ulonglong) LONG_MAX)
129 ulonglong quo= uval/(uint) 10;
130 uint rem= (uint) (uval- quo* (uint) 10);
131 *--p = _dig_vec_upper[rem];
134 long_val= (long) uval;
135 while (long_val != 0)
137 long quo= long_val/10;
138 *--p = _dig_vec_upper[(uchar) (long_val - quo*10)];
141 while ((*dst++ = *p++) != 0) ;