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

Function pool_get

modules/crypt/arith/xsBigIntEx.c:67–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static txBigInt *pool_get(xsMachine *the, txU2 size, pool_t *pool)
68{
69 // search for a free slot that fits into the size
70 for (int i = 0; i < MAX_PELM; i++) {
71 txBigInt *e = pool->pelm[i];
72 if (e == NULL) {
73 e = fxBigInt_alloc(the, size);
74 pool->pelm[i] = e;
75 return e;
76 }
77 if (e->size & FREE_MASK && (e->size & ~FREE_MASK) == size) {
78 e->size &= ~FREE_MASK;
79 return e;
80 }
81 }
82 fxAbort(the, XS_NOT_ENOUGH_MEMORY_EXIT);
83 return NULL;
84}
85
86static void pool_put(txBigInt *e, txU2 size)
87{

Callers 15

fxBigInt_mod_addFunction · 0.85
fxBigInt_mod_dblFunction · 0.85
fxBigInt_mod_subFunction · 0.85
fxBigInt_mod_mulFunction · 0.85
fxBigInt_mod_squareFunction · 0.85
fxBigInt_mod_exp_LRFunction · 0.85
mont_reductionFunction · 0.85
mont_mulFunction · 0.85
mont_squareFunction · 0.85
mont_exp_initFunction · 0.85
fxBigInt_mont_exp_LRFunction · 0.85
fxBigInt_mont_exp_SWFunction · 0.85

Calls 2

fxBigInt_allocFunction · 0.85
fxAbortFunction · 0.50

Tested by

no test coverage detected