summaryrefslogtreecommitdiff
path: root/strings/longlong2str.c
diff options
context:
space:
mode:
Diffstat (limited to 'strings/longlong2str.c')
-rw-r--r--strings/longlong2str.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/strings/longlong2str.c b/strings/longlong2str.c
index 10e9dc568f8..18bc1daa0ba 100644
--- a/strings/longlong2str.c
+++ b/strings/longlong2str.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB
+/* Copyright (c) 2000, 2001, 2004, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
@@ -12,8 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
Defines: longlong2str();
@@ -42,17 +41,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)
@@ -82,20 +82,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