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

Function remove_leading_zeroes

strings/decimal.c:251–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249
250
251static dec1 *remove_leading_zeroes(const decimal_t *from, int *intg_result)
252{
253 int intg= from->intg, i;
254 dec1 *buf0= from->buf;
255 i= ((intg - 1) % DIG_PER_DEC1) + 1;
256 while (intg > 0 && *buf0 == 0)
257 {
258 intg-= i;
259 i= DIG_PER_DEC1;
260 buf0++;
261 }
262 if (intg > 0)
263 {
264 for (i= (intg - 1) % DIG_PER_DEC1; *buf0 < powers10[i--]; intg--) ;
265 DBUG_ASSERT(intg > 0);
266 }
267 else
268 intg=0;
269 *intg_result= intg;
270 return buf0;
271}
272
273
274/*

Callers 4

decimal2stringFunction · 0.85
decimal2binFunction · 0.85
decimal_intgFunction · 0.85
do_div_modFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected