PackWriter: Prefer boolean operators over logical operators in comparisons

Using the | and & operators in boolean conditions results in a warning
from Error Prone:

  [ShortCircuitBoolean]
  Prefer the short-circuiting boolean operators && and || to & and |.
  see https://errorprone.info/bugpattern/ShortCircuitBoolean

Change-Id: I4275c60306e43c74030c4465ba02cb853ad444e1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2019-06-12 13:10:32 +09:00 committed by Matthias Sohn
parent f3b7c2beae
commit 858736df37
1 changed files with 2 additions and 2 deletions

View File

@ -2198,7 +2198,7 @@ public void select(ObjectToPack otp, StoredObjectRepresentation next) {
if (!cachedPacks.isEmpty()) {
if (otp.isEdge())
return;
if ((nFmt == PACK_WHOLE) | (nFmt == PACK_DELTA)) {
if (nFmt == PACK_WHOLE || nFmt == PACK_DELTA) {
for (CachedPack pack : cachedPacks) {
if (pack.hasObject(otp, next)) {
otp.setEdge();
@ -2241,7 +2241,7 @@ public void select(ObjectToPack otp, StoredObjectRepresentation next) {
otp.clearReuseAsIs();
}
otp.setDeltaAttempted(reuseDeltas & next.wasDeltaAttempted());
otp.setDeltaAttempted(reuseDeltas && next.wasDeltaAttempted());
otp.select(next);
}