mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 23:32:16 +00:00
BloomFilter: minor readability tweak
This commit is contained in:
parent
2f29660d0d
commit
1293e42aa3
@ -129,15 +129,11 @@ public class BloomFilter extends Message {
|
|||||||
data = readByteArray();
|
data = readByteArray();
|
||||||
if (data.length > MAX_FILTER_SIZE)
|
if (data.length > MAX_FILTER_SIZE)
|
||||||
throw new ProtocolException ("Bloom filter out of size range.");
|
throw new ProtocolException ("Bloom filter out of size range.");
|
||||||
|
|
||||||
hashFuncs = readUint32();
|
hashFuncs = readUint32();
|
||||||
if (hashFuncs > MAX_HASH_FUNCS)
|
if (hashFuncs > MAX_HASH_FUNCS)
|
||||||
throw new ProtocolException("Bloom filter hash function count out of range");
|
throw new ProtocolException("Bloom filter hash function count out of range");
|
||||||
|
|
||||||
nTweak = readUint32();
|
nTweak = readUint32();
|
||||||
|
|
||||||
nFlags = readBytes(1)[0];
|
nFlags = readBytes(1)[0];
|
||||||
|
|
||||||
length = cursor - offset;
|
length = cursor - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +153,7 @@ public class BloomFilter extends Message {
|
|||||||
// Do nothing, lazy parsing isn't useful for bloom filters.
|
// Do nothing, lazy parsing isn't useful for bloom filters.
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ROTL32 (int x, int r) {
|
private static int rotateLeft32(int x, int r) {
|
||||||
return (x << r) | (x >>> (32 - r));
|
return (x << r) | (x >>> (32 - r));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,11 +172,11 @@ public class BloomFilter extends Message {
|
|||||||
((object[i+3] & 0xFF) << 24);
|
((object[i+3] & 0xFF) << 24);
|
||||||
|
|
||||||
k1 *= c1;
|
k1 *= c1;
|
||||||
k1 = ROTL32(k1,15);
|
k1 = rotateLeft32(k1, 15);
|
||||||
k1 *= c2;
|
k1 *= c2;
|
||||||
|
|
||||||
h1 ^= k1;
|
h1 ^= k1;
|
||||||
h1 = ROTL32(h1,13);
|
h1 = rotateLeft32(h1, 13);
|
||||||
h1 = h1*5+0xe6546b64;
|
h1 = h1*5+0xe6546b64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +191,7 @@ public class BloomFilter extends Message {
|
|||||||
// Fall through.
|
// Fall through.
|
||||||
case 1:
|
case 1:
|
||||||
k1 ^= (object[numBlocks] & 0xff);
|
k1 ^= (object[numBlocks] & 0xff);
|
||||||
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
|
k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1;
|
||||||
// Fall through.
|
// Fall through.
|
||||||
default:
|
default:
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
Loading…
Reference in New Issue
Block a user