~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to strings/longlong2str.c

  • Committer: Jay Pipes
  • Date: 2008-07-17 19:43:08 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: jay@mysql.com-20080717194308-l9i4ti57gikm2qbv
Phase 1 removal of DBUG in mysys

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
  converts the (int64_t) integer "val" to character form and moves it to
21
21
  the destination string "dst" followed by a terminating NUL.  The
22
22
  result is normally a pointer to this NUL character, but if the radix
23
 
  is dud the result will be NULL and nothing will be changed.
 
23
  is dud the result will be NullS and nothing will be changed.
24
24
 
25
25
  If radix is -2..-36, val is taken to be SIGNED.
26
26
  If radix is  2.. 36, val is taken to be UNSIGNED.
37
37
        itoa assumes that 10 -base numbers are allways signed and other arn't.
38
38
*/
39
39
 
 
40
#include <my_global.h>
40
41
#include "m_string.h"
41
42
 
42
43
#if !defined(int64_t2str) && !defined(HAVE_LONGLONG2STR)
78
79
  while (uval > (uint64_t) LONG_MAX)
79
80
  {
80
81
    uint64_t quo= uval/(uint) radix;
81
 
    uint32_t rem= (uint) (uval- quo* (uint) radix);
 
82
    uint rem= (uint) (uval- quo* (uint) radix);
82
83
    *--p = _dig_vec_upper[rem];
83
84
    uval= quo;
84
85
  }
86
87
  while (long_val != 0)
87
88
  {
88
89
    long quo= long_val/radix;
89
 
    *--p = _dig_vec_upper[(unsigned char) (long_val - quo*radix)];
 
90
    *--p = _dig_vec_upper[(uchar) (long_val - quo*radix)];
90
91
    long_val= quo;
91
92
  }
92
93
  while ((*dst++ = *p++) != 0) ;
125
126
  while (uval > (uint64_t) LONG_MAX)
126
127
  {
127
128
    uint64_t quo= uval/(uint) 10;
128
 
    uint32_t rem= (uint) (uval- quo* (uint) 10);
 
129
    uint rem= (uint) (uval- quo* (uint) 10);
129
130
    *--p = _dig_vec_upper[rem];
130
131
    uval= quo;
131
132
  }
133
134
  while (long_val != 0)
134
135
  {
135
136
    long quo= long_val/10;
136
 
    *--p = _dig_vec_upper[(unsigned char) (long_val - quo*10)];
 
137
    *--p = _dig_vec_upper[(uchar) (long_val - quo*10)];
137
138
    long_val= quo;
138
139
  }
139
140
  while ((*dst++ = *p++) != 0) ;