HDDS-2257. Fix checkstyle issues in ChecksumByteBuffer (#1603)

This commit is contained in:
Vivek Ratnavel Subramanian 2019-10-04 16:36:32 -07:00 committed by Bharat Viswanadham
parent a3cf54ccdc
commit f209722a19
1 changed files with 16 additions and 8 deletions

View File

@ -47,6 +47,7 @@ public interface ChecksumByteBuffer extends Checksum {
* An abstract class implementing {@link ChecksumByteBuffer} * An abstract class implementing {@link ChecksumByteBuffer}
* with a 32-bit checksum and a lookup table. * with a 32-bit checksum and a lookup table.
*/ */
@SuppressWarnings("innerassignment")
abstract class CrcIntTable implements ChecksumByteBuffer { abstract class CrcIntTable implements ChecksumByteBuffer {
/** Current CRC value with bit-flipped. */ /** Current CRC value with bit-flipped. */
private int crc; private int crc;
@ -98,14 +99,21 @@ public interface ChecksumByteBuffer extends Checksum {
// loop unroll - duff's device style // loop unroll - duff's device style
switch (b.remaining()) { switch (b.remaining()) {
case 7: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; case 7:
case 6: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
case 5: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; case 6:
case 4: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
case 3: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; case 5:
case 2: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
case 1: crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)]; case 4:
default: // noop crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
case 3:
crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
case 2:
crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
case 1:
crc = (crc >>> 8) ^ table[((crc ^ b.get()) & 0xff)];
default: // noop
} }
return crc; return crc;