| 1744 | |
| 1745 | /** @param {number} need minimum capacity */ |
| 1746 | const _soaGrow = (need) => { |
| 1747 | let cap = _soaCap || 4096; |
| 1748 | while (cap < need) cap *= 2; |
| 1749 | const ty = new Uint8Array(cap); |
| 1750 | ty.set(_soaTy); |
| 1751 | _soaTy = ty; |
| 1752 | const st = new Int32Array(cap); |
| 1753 | st.set(_soaSt); |
| 1754 | _soaSt = st; |
| 1755 | const en = new Int32Array(cap); |
| 1756 | en.set(_soaEn); |
| 1757 | _soaEn = en; |
| 1758 | const a0 = new Int32Array(cap); |
| 1759 | a0.set(_soaA0); |
| 1760 | _soaA0 = a0; |
| 1761 | const a1 = new Int32Array(cap); |
| 1762 | a1.set(_soaA1); |
| 1763 | _soaA1 = a1; |
| 1764 | const a2 = new Int32Array(cap); |
| 1765 | a2.set(_soaA2); |
| 1766 | _soaA2 = a2; |
| 1767 | const fl = new Uint8Array(cap); |
| 1768 | fl.set(_soaFl); |
| 1769 | _soaFl = fl; |
| 1770 | _soaCap = cap; |
| 1771 | }; |
| 1772 | /** @type {(type: number, start: number, end: number) => Node} */ |
| 1773 | const _soaAlloc = (type, start, end) => { |
| 1774 | // Ids are 1-based: a node ref is used in truthiness checks (`if (!parent)`), |