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

Function fxBigIntParse

xs/sources/xsBigInt.c:457–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void fxBigIntParse(txBigInt* bigint, txString p, txSize length, txInteger sign)
458{
459 txU4 data[1] = { 0 };
460 txBigInt digit = { .sign=0, .size=1, .data=data };
461 bigint->sign = 0;
462 bigint->size = 1;
463 bigint->data[0] = 0;
464 while (length) {
465 char c = *p++;
466 data[0] = c - '0';
467 fxBigInt_uadd(NULL, bigint, fxBigInt_umul1(NULL, bigint, bigint, 10), &digit);
468 length--;
469 }
470 if ((bigint->size > 1) || (bigint->data[0] != 0))
471 bigint->sign = sign;
472}
473
474void fxBigIntParseB(txBigInt* bigint, txString p, txSize length)
475{

Callers 2

fxGetNextNumberEFunction · 0.85
fxStringToBigIntFunction · 0.85

Calls 2

fxBigInt_uaddFunction · 0.85
fxBigInt_umul1Function · 0.85

Tested by

no test coverage detected