From 4671dca0ad45c3d0915e0c0cd9453da4afd51409 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sat, 20 Jul 2019 23:56:18 +0000 Subject: [PATCH] Tweaked a bit of code for simplicity. --- src/io/nayuki/fastqrcodegen/QrCode.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/io/nayuki/fastqrcodegen/QrCode.java b/src/io/nayuki/fastqrcodegen/QrCode.java index 6d44c47..0093a27 100644 --- a/src/io/nayuki/fastqrcodegen/QrCode.java +++ b/src/io/nayuki/fastqrcodegen/QrCode.java @@ -377,13 +377,10 @@ public final class QrCode { private void setModule(int x, int y, int black) { assert 0 <= x && x < size; assert 0 <= y && y < size; + assert black == 0 || black == 1; int i = y * size + x; - if (black == 0) - modules[i >>> 5] &= ~(1 << i); - else if (black == 1) - modules[i >>> 5] |= 1 << i; - else - throw new IllegalArgumentException(); + modules[i >>> 5] &= ~(1 << i); + modules[i >>> 5] |= black << i; }