MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / int10_to_str

Function int10_to_str

strings/int2str.c:133–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131*/
132
133char *int10_to_str(long int val,char *dst,int radix)
134{
135 char buffer[65];
136 register char *p;
137 long int new_val;
138 unsigned long int uval = (unsigned long int) val;
139
140 if (radix < 0) /* -10 */
141 {
142 if (val < 0)
143 {
144 *dst++ = '-';
145 /* Avoid integer overflow in (-val) for LONGLONG_MIN (BUG#31799). */
146 uval = (unsigned long int)0 - uval;
147 }
148 }
149
150 p = &buffer[sizeof(buffer)-1];
151 *p = '\0';
152 new_val= (long) (uval / 10);
153 *--p = '0'+ (char) (uval - (unsigned long) new_val * 10);
154 val = new_val;
155
156 while (val != 0)
157 {
158 new_val=val/10;
159 *--p = '0' + (char) (val-new_val*10);
160 val= new_val;
161 }
162 while ((*dst++ = *p++) != 0) ;
163 return dst-1;
164}

Callers 13

my_vsnprintf_mb2Function · 0.85
my_vsnprintf_utf32Function · 0.85
create_shared_memoryFunction · 0.85
make_date_timeFunction · 0.85
printMethod · 0.85
net_store_dataFunction · 0.85
store_tinyMethod · 0.85
store_shortMethod · 0.85
store_longMethod · 0.85
append_parenthesizedMethod · 0.85
qs_appendMethod · 0.85
get_charsetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected