diff --git a/core/src/com/google/zxing/datamatrix/detector/Detector.java b/core/src/com/google/zxing/datamatrix/detector/Detector.java index 4e47692ab..3cd2c1da0 100644 --- a/core/src/com/google/zxing/datamatrix/detector/Detector.java +++ b/core/src/com/google/zxing/datamatrix/detector/Detector.java @@ -231,7 +231,7 @@ public final class Detector { boolean inBlack = image.isBlack(steep ? fromY : fromX, steep ? fromX : fromY); for (int x = fromX, y = fromY; x != toX; x += xstep) { boolean isBlack = image.isBlack(steep ? y : x, steep ? x : y); - if (isBlack == !inBlack) { + if (isBlack != inBlack) { transitions++; inBlack = isBlack; } diff --git a/core/src/com/google/zxing/oned/AbstractOneDReader.java b/core/src/com/google/zxing/oned/AbstractOneDReader.java index 7506db5d3..004eb4717 100644 --- a/core/src/com/google/zxing/oned/AbstractOneDReader.java +++ b/core/src/com/google/zxing/oned/AbstractOneDReader.java @@ -169,7 +169,7 @@ public abstract class AbstractOneDReader implements OneDReader { int i = start; while (i < end) { boolean pixel = row.get(i); - if ((!pixel && isWhite) || (pixel && !isWhite)) { + if (pixel ^ isWhite) { // that is, exactly one is true counters[counterPosition]++; } else { counterPosition++; @@ -177,7 +177,7 @@ public abstract class AbstractOneDReader implements OneDReader { break; } else { counters[counterPosition] = 1; - isWhite = !isWhite; + isWhite ^= true; // isWhite = !isWhite; Is this too clever? shorter byte code, no conditional } } i++; diff --git a/core/src/com/google/zxing/oned/AbstractUPCEANReader.java b/core/src/com/google/zxing/oned/AbstractUPCEANReader.java index 5336e0dc3..ab9da0aa3 100644 --- a/core/src/com/google/zxing/oned/AbstractUPCEANReader.java +++ b/core/src/com/google/zxing/oned/AbstractUPCEANReader.java @@ -228,7 +228,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements int patternStart = rowOffset; for (int x = rowOffset; x < width; x++) { boolean pixel = row.get(x); - if ((!pixel && isWhite) || (pixel && !isWhite)) { + if (pixel ^ isWhite) { counters[counterPosition]++; } else { if (counterPosition == patternLength - 1) { @@ -246,7 +246,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements counterPosition++; } counters[counterPosition] = 1; - isWhite = !isWhite; + isWhite ^= true; // isWhite = !isWhite; } } throw ReaderException.getInstance(); diff --git a/core/src/com/google/zxing/oned/Code128Reader.java b/core/src/com/google/zxing/oned/Code128Reader.java index 75be5607a..59da16720 100644 --- a/core/src/com/google/zxing/oned/Code128Reader.java +++ b/core/src/com/google/zxing/oned/Code128Reader.java @@ -180,7 +180,7 @@ public final class Code128Reader extends AbstractOneDReader { for (int i = rowOffset; i < width; i++) { boolean pixel = row.get(i); - if ((!pixel && isWhite) || (pixel && !isWhite)) { + if (pixel ^ isWhite) { counters[counterPosition]++; } else { if (counterPosition == patternLength - 1) { @@ -210,7 +210,7 @@ public final class Code128Reader extends AbstractOneDReader { counterPosition++; } counters[counterPosition] = 1; - isWhite = !isWhite; + isWhite ^= true; // isWhite = !isWhite; } } throw ReaderException.getInstance(); diff --git a/core/src/com/google/zxing/oned/Code39Reader.java b/core/src/com/google/zxing/oned/Code39Reader.java index 50f25091e..7a7514cf8 100644 --- a/core/src/com/google/zxing/oned/Code39Reader.java +++ b/core/src/com/google/zxing/oned/Code39Reader.java @@ -184,7 +184,7 @@ public final class Code39Reader extends AbstractOneDReader { for (int i = rowOffset; i < width; i++) { boolean pixel = row.get(i); - if ((!pixel && isWhite) || (pixel && !isWhite)) { + if (pixel ^ isWhite) { counters[counterPosition]++; } else { if (counterPosition == patternLength - 1) { @@ -209,7 +209,7 @@ public final class Code39Reader extends AbstractOneDReader { counterPosition++; } counters[counterPosition] = 1; - isWhite = !isWhite; + isWhite ^= true; // isWhite = !isWhite; } } throw ReaderException.getInstance(); diff --git a/core/src/com/google/zxing/oned/ITFReader.java b/core/src/com/google/zxing/oned/ITFReader.java index 49f065db3..cf68d5845 100644 --- a/core/src/com/google/zxing/oned/ITFReader.java +++ b/core/src/com/google/zxing/oned/ITFReader.java @@ -296,7 +296,7 @@ public final class ITFReader extends AbstractOneDReader { int patternStart = rowOffset; for (int x = rowOffset; x < width; x++) { boolean pixel = row.get(x); - if ((!pixel && isWhite) || (pixel && !isWhite)) { + if (pixel ^ isWhite) { counters[counterPosition]++; } else { if (counterPosition == patternLength - 1) { @@ -314,7 +314,7 @@ public final class ITFReader extends AbstractOneDReader { counterPosition++; } counters[counterPosition] = 1; - isWhite = !isWhite; + isWhite ^= true; // isWhite = !isWhite; } } throw ReaderException.getInstance(); diff --git a/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java b/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java index 8e1ff46b9..db86fde7c 100644 --- a/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java +++ b/core/src/com/google/zxing/qrcode/decoder/BitMatrixParser.java @@ -198,7 +198,7 @@ final class BitMatrixParser { } } } - readingUp = !readingUp; // switch directions + readingUp ^= true; // readingUp = !readingUp; // switch directions } if (resultOffset != version.getTotalCodewords()) { throw ReaderException.getInstance();