| 65 | } |
| 66 | |
| 67 | static 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 | |
| 86 | static void pool_put(txBigInt *e, txU2 size) |
| 87 | { |
no test coverage detected