Skip to content

Commit

Permalink
Reduce size of constant data
Browse files Browse the repository at this point in the history
  • Loading branch information
WasabiThumb committed Jul 9, 2024
1 parent 048de62 commit 672870c
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 396 deletions.
15 changes: 10 additions & 5 deletions src/collection/bitMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ export class BitMatrix {

private static ACCESS_HINT_PRIVATE = Symbol();

static of(array: number[][]): BitMatrix {
if (array.length < 1) return new BitMatrix(0, 0);
const ret = new BitMatrix(array[0].length, array.length);
for (let y=0; y < array.length; y++) {
ret.setRow(y, BitArray.of(array[y]));
/**
* For internal usage. Creates a BitMatrix from the specified bits with a width of at most 8
*/
static raw(width: number, ...rows: number[]): BitMatrix {
const height: number = rows.length;
const row = new BitArray(width);
const ret = new BitMatrix(width, height);
for (let i=0; i < height; i++) {
row.setBulk(0, rows[i]);
ret.setRow(i, row);
}
return ret;
}
Expand Down
Loading

0 comments on commit 672870c

Please sign in to comment.