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

Function b2d

strings/dtoa.c:1195–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1193
1194
1195static double b2d(Bigint *a, int *e)
1196{
1197 ULong *xa, *xa0, w, y, z;
1198 int k;
1199 U d;
1200#define d0 word0(&d)
1201#define d1 word1(&d)
1202
1203 xa0= a->p.x;
1204 xa= xa0 + a->wds;
1205 y= *--xa;
1206 k= hi0bits(y);
1207 *e= 32 - k;
1208 if (k < Ebits)
1209 {
1210 d0= Exp_1 | y >> (Ebits - k);
1211 w= xa > xa0 ? *--xa : 0;
1212 d1= y << ((32-Ebits) + k) | w >> (Ebits - k);
1213 goto ret_d;
1214 }
1215 z= xa > xa0 ? *--xa : 0;
1216 if (k-= Ebits)
1217 {
1218 d0= Exp_1 | y << k | z >> (32 - k);
1219 y= xa > xa0 ? *--xa : 0;
1220 d1= z << k | y >> (32 - k);
1221 }
1222 else
1223 {
1224 d0= Exp_1 | y;
1225 d1= z;
1226 }
1227 ret_d:
1228#undef d0
1229#undef d1
1230 return dval(&d);
1231}
1232
1233
1234static Bigint *d2b(U *d, int *e, int *bits, Stack_alloc *alloc)

Callers 1

ratioFunction · 0.85

Calls 1

hi0bitsFunction · 0.85

Tested by

no test coverage detected