summaryrefslogtreecommitdiff
path: root/strings/longlong2str.c
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-02-03 03:06:42 +0300
committerKonstantin Osipov <kostja@sun.com>2010-02-03 03:06:42 +0300
commit0ce6d93f858eb5b67f8988946274ab2b9f060de4 (patch)
tree8555c47c0ce18227ce535252d2c2966af26183d3 /strings/longlong2str.c
parentc2fe19883e624ddd0e37768f860fa0853848adb3 (diff)
parente698ae01128fde4f82d4595e67a72cfac09ca125 (diff)
downloadmariadb-git-0ce6d93f858eb5b67f8988946274ab2b9f060de4.tar.gz
Merge next-mr -> next-4284.
Diffstat (limited to 'strings/longlong2str.c')
-rw-r--r--strings/longlong2str.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/strings/longlong2str.c b/strings/longlong2str.c
index d7de5bb0f7c..641ae0955d3 100644
--- a/strings/longlong2str.c
+++ b/strings/longlong2str.c
@@ -40,17 +40,18 @@
#include <my_global.h>
#include "m_string.h"
-#if defined(HAVE_LONG_LONG) && !defined(longlong2str) && !defined(HAVE_LONGLONG2STR)
+#ifndef ll2str
/*
This assumes that longlong multiplication is faster than longlong division.
*/
-char *longlong2str(longlong val,char *dst,int radix)
+char *ll2str(longlong val,char *dst,int radix, int upcase)
{
char buffer[65];
register char *p;
long long_val;
+ char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower;
ulonglong uval= (ulonglong) val;
if (radix < 0)
@@ -80,20 +81,19 @@ char *longlong2str(longlong val,char *dst,int radix)
{
ulonglong quo= uval/(uint) radix;
uint rem= (uint) (uval- quo* (uint) radix);
- *--p = _dig_vec_upper[rem];
+ *--p= dig_vec[rem];
uval= quo;
}
long_val= (long) uval;
while (long_val != 0)
{
long quo= long_val/radix;
- *--p = _dig_vec_upper[(uchar) (long_val - quo*radix)];
+ *--p= dig_vec[(uchar) (long_val - quo*radix)];
long_val= quo;
}
while ((*dst++ = *p++) != 0) ;
return dst-1;
}
-
#endif
#ifndef longlong10_to_str