From 7561941341284c2f0886fc0dc5012242a9306d23 Mon Sep 17 00:00:00 2001 From: srowen Date: Mon, 9 Mar 2009 15:56:08 +0000 Subject: [PATCH] Tiny optimization to reverse() git-svn-id: https://zxing.googlecode.com/svn/trunk@880 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- core/src/com/google/zxing/common/BitArray.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/com/google/zxing/common/BitArray.java b/core/src/com/google/zxing/common/BitArray.java index c2969608a..ce4ea0806 100644 --- a/core/src/com/google/zxing/common/BitArray.java +++ b/core/src/com/google/zxing/common/BitArray.java @@ -133,11 +133,7 @@ public final class BitArray { * Reverses all bits in the array. */ public void reverse() { - int[] newBits = makeArray(size); - int max = newBits.length; - for (int i = 0; i < max; i++) { - newBits[i] = 0; - } + int[] newBits = new int[bits.length]; int size = this.size; for (int i = 0; i < size; i++) { if (get(size - i - 1)) { @@ -158,7 +154,7 @@ public final class BitArray { public String toString() { StringBuffer result = new StringBuffer(size); for (int i = 0; i < size; i++) { - if (i % 8 == 0) { + if ((i & 0x07) == 0) { result.append(' '); } result.append(get(i) ? 'X' : '.');