MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxBigInt_ulsl1

Function fxBigInt_ulsl1

xs/sources/xsBigInt.c:1267–1294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1265}
1266
1267txBigInt *fxBigInt_ulsl1(txMachine* the, txBigInt *r, txBigInt *a, txU4 sw)
1268{
1269 txU4 wsz, bsz;
1270 int n;
1271
1272 wsz = sw / mxBigIntWordSize;
1273 bsz = sw % mxBigIntWordSize;
1274 n = a->size + wsz + ((bsz == 0) ? 0 : 1);
1275 if (r == NULL)
1276 r = fxBigInt_alloc(the, n);
1277 if (bsz == 0) {
1278 c_memmove(&r->data[wsz], a->data, a->size * sizeof(txU4));
1279 c_memset(r->data, 0, wsz * sizeof(txU4));
1280 r->size = a->size + wsz;
1281 }
1282 else {
1283 r->data[a->size + wsz] = a->data[a->size - 1] >> (mxBigIntWordSize - bsz);
1284 for (n = a->size; --n >= 1;)
1285 r->data[n + wsz] = (a->data[n] << bsz) | (a->data[n - 1] >> (mxBigIntWordSize - bsz));
1286 r->data[wsz] = a->data[0] << bsz;
1287 /* clear the remaining part */
1288 for (n = wsz; --n >= 0;)
1289 r->data[n] = 0;
1290 /* adjust r */
1291 r->size = a->size + wsz + (r->data[a->size + wsz] == 0 ? 0: 1);
1292 }
1293 return(r);
1294}
1295
1296txBigInt *fxBigInt_lsr(txMachine* the, txBigInt *r, txBigInt *a, txBigInt *b)
1297{

Callers 10

fxBigInt_mod_dblFunction · 0.85
mont_inFunction · 0.85
fx_BigInt_asIntNFunction · 0.85
fx_BigInt_asUintNFunction · 0.85
fxBigIntParseBFunction · 0.85
fxBigIntParseOFunction · 0.85
fxBigIntParseXFunction · 0.85
fxBigInt_lslFunction · 0.85
fxBigInt_lsrFunction · 0.85
fxBigInt_udivFunction · 0.85

Calls 1

fxBigInt_allocFunction · 0.85

Tested by

no test coverage detected