Browse Source

Simplify setDoNotDelta() to always set the flag

This method is only invoked with true as the argument.
Remove the unnecessary parameter and branch, making
the code easier for the JIT to optimize.

Change-Id: I68a9cd82f197b7d00a524ea3354260a0828083c6
stable-3.0
Shawn Pearce 12 years ago
parent
commit
594d4ceb12
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

5
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java

@ -241,11 +241,8 @@ public class ObjectToPack extends PackedObjectInfo {
return (flags & DO_NOT_DELTA) != 0; return (flags & DO_NOT_DELTA) != 0;
} }
void setDoNotDelta(boolean noDelta) { void setDoNotDelta() {
if (noDelta)
flags |= DO_NOT_DELTA; flags |= DO_NOT_DELTA;
else
flags &= ~DO_NOT_DELTA;
} }
boolean isEdge() { boolean isEdge() {

8
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

@ -1157,13 +1157,13 @@ public class PackWriter {
if (ignoreMissingUninteresting) { if (ignoreMissingUninteresting) {
ObjectToPack otp = sizeQueue.getCurrent(); ObjectToPack otp = sizeQueue.getCurrent();
if (otp != null && otp.isEdge()) { if (otp != null && otp.isEdge()) {
otp.setDoNotDelta(true); otp.setDoNotDelta();
continue; continue;
} }
otp = objectsMap.get(notFound.getObjectId()); otp = objectsMap.get(notFound.getObjectId());
if (otp != null && otp.isEdge()) { if (otp != null && otp.isEdge()) {
otp.setDoNotDelta(true); otp.setDoNotDelta();
continue; continue;
} }
} }
@ -1176,10 +1176,10 @@ public class PackWriter {
long sz = sizeQueue.getSize(); long sz = sizeQueue.getSize();
if (limit <= sz || Integer.MAX_VALUE <= sz) if (limit <= sz || Integer.MAX_VALUE <= sz)
otp.setDoNotDelta(true); // too big, avoid costly files otp.setDoNotDelta(); // too big, avoid costly files
else if (sz <= DeltaIndex.BLKSZ) else if (sz <= DeltaIndex.BLKSZ)
otp.setDoNotDelta(true); // too small, won't work otp.setDoNotDelta(); // too small, won't work
else else
otp.setWeight((int) sz); otp.setWeight((int) sz);

Loading…
Cancel
Save