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

Function do_mini_left_shift

strings/decimal.c:524–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522*/
523
524void do_mini_left_shift(decimal_t *dec, int shift, int beg, int last)
525{
526 dec1 *from= dec->buf + ROUND_UP(beg + 1) - 1;
527 dec1 *end= dec->buf + ROUND_UP(last) - 1;
528 int c_shift= DIG_PER_DEC1 - shift;
529 DBUG_ASSERT(from >= dec->buf);
530 DBUG_ASSERT(end < dec->buf + dec->len);
531 if (beg % DIG_PER_DEC1 < shift)
532 *(from - 1)= (*from) / powers10[c_shift];
533 for(; from < end; from++)
534 *from= ((*from % powers10[c_shift]) * powers10[shift] +
535 (*(from + 1)) / powers10[c_shift]);
536 *from= (*from % powers10[c_shift]) * powers10[shift];
537}
538
539
540/*

Callers 1

decimal_shiftFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected