export function forEachCellInColumn()

in packages/core/micro/src/matrix.ts [169:197]


export function forEachCellInColumn<T>(grid: SparseGrid<T>, column: number, cb: (r: number, c: number, value: T) => void): void {
    const colIdx1 = colIdx(column, 3);
    const colIdx2 = colIdx(column, 2);
    const colIdx3 = colIdx(column, 1);
    const colIdx4 = colIdx(column, 0);
    for (let r1 = 0; r1 < CONSTS.H; r1++) {
        const t1 = grid[colIdx1 | r1];
        if (t1 === undefined) { continue; }
        for (let r2 = 0; r2 < CONSTS.H; r2++) {
            const t2 = t1[colIdx2 | r2];
            if (t2 === undefined) { continue; }
            for (let r3 = 0; r3 < CONSTS.H; r3++) {
                const t3 = t2[colIdx3 | r3];
                if (t3 === undefined) { continue; }
                for (let r4 = 0; r4 < CONSTS.H; r4++) {
                    const cell = t3[colIdx4 | r4];
                    if (cell === undefined) { continue; }
                    cb(
                        (r1 & CONSTS.MH) << (3 * CONSTS.LOGH) |
                        (r2 & CONSTS.MH) << (2 * CONSTS.LOGH) |
                        (r3 & CONSTS.MH) << CONSTS.LOGH |
                        r4 & CONSTS.MH,
                        column, cell as any     // eslint-disable-line @typescript-eslint/no-explicit-any
                    );
                }
            }
        }
    }
}