2005-01-26 smeghead

* i2pProxy.pac, i2pbench.sh, and i2ptest.sh are now shipped with the dist
      packages and installed to $i2pinstalldir/scripts.
    * Added command line params to i2ptest.sh and i2pbench.sh: --gij to run them
      using gij + libgcj, and --sourcedir to run them from the source tree
      instead of the installation directory.
    * Fixed unreachable for() statement clause in the KBucketImpl class that was
      causing gcj to toss a compilation warning (jrandom++).
This commit is contained in:
smeghead
2005-01-27 04:48:41 +00:00
committed by zzz
parent b39958604d
commit 5f6060b801
6 changed files with 87 additions and 29 deletions

View File

@ -108,32 +108,39 @@ class KBucketImpl implements KBucket {
return false;
for (int i = 0; i < distance.length; i++) {
if ( (i < upperLimitByte) && (distance[i] != 0x00) ) {
// outright too large
return true;
} else {
int upperVal = 1 << (upperLimitBit % 8);
if (distance[i] > upperVal) {
// still too large, but close
if (i < upperLimitByte) {
if (distance[i] != 0x00) {
// outright too large
return true;
} else if (distance[i] == upperVal) {
// ok, it *may* equal the upper limit,
// if the rest of the bytes are 0
for (int j = i+1; j < distance.length; i++) {
if (distance[j] != 0x00) {
// nope
return true;
}
}
// w00t, the rest is made of 0x00 bytes, so it
// exactly matches the upper limit. kooky, very improbable,
// but possible
}
} else if (i == upperLimitByte) {
if (distance[i] == 0x00) {
// no bits set through the high bit
return false;
} else {
// no bits set before or at the upper limit, so its
// definitely not too large
return false;
int upperVal = 1 << (upperLimitBit % 8);
if (distance[i] > upperVal) {
// still too large, but close
return true;
} else if (distance[i] == upperVal) {
// ok, it *may* equal the upper limit,
// if the rest of the bytes are 0
for (int j = i+1; j < distance.length; j++) {
if (distance[j] != 0x00) {
// nope
return true;
}
}
// w00t, the rest is made of 0x00 bytes, so it
// exactly matches the upper limit. kooky, very improbable,
// but possible
return false;
}
}
} else if (i > upperLimitByte) {
// no bits set before or at the upper limit, so its
// definitely not too large
return false;
}
}
_log.log(Log.CRIT, "wtf, gravity broke: distance=" + DataHelper.toHexString(distance)