From ae22a368bb30651449466161b404582816caa7d8 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Wed, 29 Jan 2020 17:23:44 +0000 Subject: [PATCH] De-optimized a bit of Java code to tighten scope at the expense of allocating more temporary memory. --- java/src/main/java/io/nayuki/qrcodegen/QrCode.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/java/src/main/java/io/nayuki/qrcodegen/QrCode.java b/java/src/main/java/io/nayuki/qrcodegen/QrCode.java index 59608e8..c0a8871 100644 --- a/java/src/main/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/src/main/java/io/nayuki/qrcodegen/QrCode.java @@ -596,11 +596,10 @@ public final class QrCode { int result = 0; // Adjacent modules in row having same color, and finder-like patterns - int[] runHistory = new int[7]; for (int y = 0; y < size; y++) { boolean runColor = false; int runX = 0; - Arrays.fill(runHistory, 0); + int[] runHistory = new int[7]; int padRun = size; // Add white border to initial run for (int x = 0; x < size; x++) { if (modules[y][x] == runColor) { @@ -624,7 +623,7 @@ public final class QrCode { for (int x = 0; x < size; x++) { boolean runColor = false; int runY = 0; - Arrays.fill(runHistory, 0); + int[] runHistory = new int[7]; int padRun = size; // Add white border to initial run for (int y = 0; y < size; y++) { if (modules[y][x] == runColor) {