Tweaked a bit of code for simplicity.

pull/134/head
Project Nayuki 5 years ago
parent afc12dc9d2
commit 4671dca0ad

@ -377,13 +377,10 @@ public final class QrCode {
private void setModule(int x, int y, int black) { private void setModule(int x, int y, int black) {
assert 0 <= x && x < size; assert 0 <= x && x < size;
assert 0 <= y && y < size; assert 0 <= y && y < size;
assert black == 0 || black == 1;
int i = y * size + x; int i = y * size + x;
if (black == 0)
modules[i >>> 5] &= ~(1 << i); modules[i >>> 5] &= ~(1 << i);
else if (black == 1) modules[i >>> 5] |= black << i;
modules[i >>> 5] |= 1 << i;
else
throw new IllegalArgumentException();
} }

Loading…
Cancel
Save