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

Function diff

strings/dtoa.c:1129–1180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1127
1128
1129static Bigint *diff(Bigint *a, Bigint *b, Stack_alloc *alloc)
1130{
1131 Bigint *c;
1132 int i, wa, wb;
1133 ULong *xa, *xae, *xb, *xbe, *xc;
1134 ULLong borrow, y;
1135
1136 i= cmp(a,b);
1137 if (!i)
1138 {
1139 c= Balloc(0, alloc);
1140 c->wds= 1;
1141 c->p.x[0]= 0;
1142 return c;
1143 }
1144 if (i < 0)
1145 {
1146 c= a;
1147 a= b;
1148 b= c;
1149 i= 1;
1150 }
1151 else
1152 i= 0;
1153 c= Balloc(a->k, alloc);
1154 c->sign= i;
1155 wa= a->wds;
1156 xa= a->p.x;
1157 xae= xa + wa;
1158 wb= b->wds;
1159 xb= b->p.x;
1160 xbe= xb + wb;
1161 xc= c->p.x;
1162 borrow= 0;
1163 do
1164 {
1165 y= (ULLong)*xa++ - *xb++ - borrow;
1166 borrow= y >> 32 & (ULong)1;
1167 *xc++= (ULong) (y & FFFFFFFF);
1168 }
1169 while (xb < xbe);
1170 while (xa < xae)
1171 {
1172 y= *xa++ - borrow;
1173 borrow= y >> 32 & (ULong)1;
1174 *xc++= (ULong) (y & FFFFFFFF);
1175 }
1176 while (!*--xc)
1177 wa--;
1178 c->wds= wa;
1179 return c;
1180}
1181
1182
1183static double ulp(U *x)

Callers 3

my_strtod_intFunction · 0.85
dtoaFunction · 0.85
AS2Function · 0.85

Calls 2

cmpFunction · 0.85
BallocFunction · 0.85

Tested by

no test coverage detected