Reformat all files in the project according to java conventions.

This commit is contained in:
Jonathan Leibiusky
2014-01-31 11:24:06 -05:00
parent 3e99749b2e
commit 105ca9f5bb
95 changed files with 5946 additions and 5825 deletions

View File

@@ -1,21 +1,23 @@
package redis.clients.util;
public class JedisClusterCRC16 {
public final static int polynomial = 0x1021; // Represents x^16+x^12+x^5+1
static int crc;
public static int getSlot(String key) {
crc = 0x0000;
for (byte b : key.getBytes()) {
for (int i = 0; i < 8; i++) {
boolean bit = ((b >> (7-i) & 1) == 1);
boolean c15 = ((crc >> 15 & 1) == 1);
crc <<= 1;
// If coefficient of bit and remainder polynomial = 1 xor crc with polynomial
if (c15 ^ bit) crc ^= polynomial;
}
}
public final static int polynomial = 0x1021; // Represents x^16+x^12+x^5+1
static int crc;
return crc &= 0xffff % 16384;
}
public static int getSlot(String key) {
crc = 0x0000;
for (byte b : key.getBytes()) {
for (int i = 0; i < 8; i++) {
boolean bit = ((b >> (7 - i) & 1) == 1);
boolean c15 = ((crc >> 15 & 1) == 1);
crc <<= 1;
// If coefficient of bit and remainder polynomial = 1 xor crc
// with polynomial
if (c15 ^ bit)
crc ^= polynomial;
}
}
return crc &= 0xffff % 16384;
}
}