Removes pointless bitwise operations

Examples are << 0 and >>> 0

These do nothing at all, and so, should not be there in the first place

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
This commit is contained in:
Cruz Julian Bishop 2012-08-09 08:54:54 +10:00
parent d206ef6d15
commit e685ce36fc
5 changed files with 18 additions and 18 deletions

View File

@ -62,14 +62,14 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
public int getUnsignedMedium(int index) {
return (array[index] & 0xff) << 16 |
(array[index + 1] & 0xff) << 8 |
(array[index + 2] & 0xff) << 0;
(array[index + 2] & 0xff);
}
public int getInt(int index) {
return (array[index] & 0xff) << 24 |
(array[index + 1] & 0xff) << 16 |
(array[index + 2] & 0xff) << 8 |
(array[index + 3] & 0xff) << 0;
(array[index + 3] & 0xff);
}
public long getLong(int index) {
@ -80,25 +80,25 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
((long) array[index + 4] & 0xff) << 24 |
((long) array[index + 5] & 0xff) << 16 |
((long) array[index + 6] & 0xff) << 8 |
((long) array[index + 7] & 0xff) << 0;
((long) array[index + 7] & 0xff);
}
public void setShort(int index, int value) {
array[index] = (byte) (value >>> 8);
array[index + 1] = (byte) (value >>> 0);
array[index + 1] = (byte) (value);
}
public void setMedium(int index, int value) {
array[index] = (byte) (value >>> 16);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 0);
array[index + 2] = (byte) (value);
}
public void setInt(int index, int value) {
array[index] = (byte) (value >>> 24);
array[index + 1] = (byte) (value >>> 16);
array[index + 2] = (byte) (value >>> 8);
array[index + 3] = (byte) (value >>> 0);
array[index + 3] = (byte) (value);
}
public void setLong(int index, long value) {
@ -109,7 +109,7 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
array[index + 4] = (byte) (value >>> 24);
array[index + 5] = (byte) (value >>> 16);
array[index + 6] = (byte) (value >>> 8);
array[index + 7] = (byte) (value >>> 0);
array[index + 7] = (byte) (value);
}
public ChannelBuffer duplicate() {

View File

@ -99,7 +99,7 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
public int getUnsignedMedium(int index) {
return (getByte(index) & 0xff) << 16 |
(getByte(index + 1) & 0xff) << 8 |
(getByte(index + 2) & 0xff) << 0;
(getByte(index + 2) & 0xff);
}
public int getInt(int index) {
@ -158,7 +158,7 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
public void setMedium(int index, int value) {
setByte(index, (byte) (value >>> 16));
setByte(index + 1, (byte) (value >>> 8));
setByte(index + 2, (byte) (value >>> 0));
setByte(index + 2, (byte) (value));
}
public void setInt(int index, int value) {

View File

@ -108,7 +108,7 @@ public final class ChannelBuffers {
final char[] DIGITS = "0123456789abcdef".toCharArray();
for (int i = 0; i < 256; i ++) {
HEXDUMP_TABLE[(i << 1) + 0] = DIGITS[i >>> 4 & 0x0F];
HEXDUMP_TABLE[(i << 1) + 1] = DIGITS[i >>> 0 & 0x0F];
HEXDUMP_TABLE[(i << 1) + 1] = DIGITS[i & 0x0F];
}
}

View File

@ -60,20 +60,20 @@ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer {
}
public int getUnsignedMedium(int index) {
return (array[index] & 0xff) << 0 |
return (array[index] & 0xff) |
(array[index + 1] & 0xff) << 8 |
(array[index + 2] & 0xff) << 16;
}
public int getInt(int index) {
return (array[index] & 0xff) << 0 |
return (array[index] & 0xff) |
(array[index + 1] & 0xff) << 8 |
(array[index + 2] & 0xff) << 16 |
(array[index + 3] & 0xff) << 24;
}
public long getLong(int index) {
return ((long) array[index] & 0xff) << 0 |
return ((long) array[index] & 0xff) |
((long) array[index + 1] & 0xff) << 8 |
((long) array[index + 2] & 0xff) << 16 |
((long) array[index + 3] & 0xff) << 24 |
@ -84,25 +84,25 @@ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer {
}
public void setShort(int index, int value) {
array[index] = (byte) (value >>> 0);
array[index] = (byte) (value);
array[index + 1] = (byte) (value >>> 8);
}
public void setMedium(int index, int value) {
array[index] = (byte) (value >>> 0);
array[index] = (byte) (value);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 16);
}
public void setInt(int index, int value) {
array[index] = (byte) (value >>> 0);
array[index] = (byte) (value);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 16);
array[index + 3] = (byte) (value >>> 24);
}
public void setLong(int index, long value) {
array[index] = (byte) (value >>> 0);
array[index] = (byte) (value);
array[index + 1] = (byte) (value >>> 8);
array[index + 2] = (byte) (value >>> 16);
array[index + 3] = (byte) (value >>> 24);

View File

@ -246,7 +246,7 @@ public class SpdyFrameEncoder implements ChannelDownstreamHandler {
// Chromium Issue 79156
// SPDY setting ids are not written in network byte order
// Write id assuming the architecture is little endian
frame.writeByte(id >> 0 & 0xFF);
frame.writeByte(id & 0xFF);
frame.writeByte(id >> 8 & 0xFF);
frame.writeByte(id >> 16 & 0xFF);
frame.writeByte(ID_flags);