Libraryless. Click here for Pure Java version (5557L/30K).
persistable sclass IntArrayBitMatrix extends AbstractMatrix<Bool> is BitMatrix { int[] data; *(int *w, int *h) { data = new int[arrayLength()]; } *(int *w, int *h, int[] *data) {} int arrayLength() { ret (w*h+31)/32; } static int arrayLength(int w, int h) { ret (w*h+31)/32; } public Bool get(int x, int y) { try { ret getBitFromIntArray_littleEndian(data, y*w+x); } catch e { fail(e, "Access out of bounds", +x, +y, +w, +h); } } public void set(int x, int y, Bool a default true) { setBitInIntArray_littleEndian(data, y*w+x, a); } }
Began life as a copy of #1033581
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033661 |
| Snippet name: | IntArrayBitMatrix - simple int array-based implementation of BitMatrix |
| Eternal ID of this version: | #1033661/5 |
| Text MD5: | 73f99e5a2b91abe5e06e828ff942d4b5 |
| Transpilation MD5: | b13ab7b69fdfca594bd7ddfd0d4bd608 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-01-06 23:15:26 |
| Source code size: | 601 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 366 / 509 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |