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

Function lshift

strings/dtoa.c:1065–1102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1063
1064
1065static Bigint *lshift(Bigint *b, int k, Stack_alloc *alloc)
1066{
1067 int i, k1, n, n1;
1068 Bigint *b1;
1069 ULong *x, *x1, *xe, z;
1070
1071 n= k >> 5;
1072 k1= b->k;
1073 n1= n + b->wds + 1;
1074 for (i= b->maxwds; n1 > i; i<<= 1)
1075 k1++;
1076 b1= Balloc(k1, alloc);
1077 x1= b1->p.x;
1078 for (i= 0; i < n; i++)
1079 *x1++= 0;
1080 x= b->p.x;
1081 xe= x + b->wds;
1082 if (k&= 0x1f)
1083 {
1084 k1= 32 - k;
1085 z= 0;
1086 do
1087 {
1088 *x1++= *x << k | z;
1089 z= *x++ >> k1;
1090 }
1091 while (x < xe);
1092 if ((*x1= z))
1093 ++n1;
1094 }
1095 else
1096 do
1097 *x1++= *x++;
1098 while (x < xe);
1099 b1->wds= n1 - 1;
1100 Bfree(b, alloc);
1101 return b1;
1102}
1103
1104
1105static int cmp(Bigint *a, Bigint *b)

Callers 2

my_strtod_intFunction · 0.85
dtoaFunction · 0.85

Calls 2

BallocFunction · 0.85
BfreeFunction · 0.85

Tested by

no test coverage detected