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:
parent
d206ef6d15
commit
e685ce36fc
@ -62,14 +62,14 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
|
|||||||
public int getUnsignedMedium(int index) {
|
public int getUnsignedMedium(int index) {
|
||||||
return (array[index] & 0xff) << 16 |
|
return (array[index] & 0xff) << 16 |
|
||||||
(array[index + 1] & 0xff) << 8 |
|
(array[index + 1] & 0xff) << 8 |
|
||||||
(array[index + 2] & 0xff) << 0;
|
(array[index + 2] & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInt(int index) {
|
public int getInt(int index) {
|
||||||
return (array[index] & 0xff) << 24 |
|
return (array[index] & 0xff) << 24 |
|
||||||
(array[index + 1] & 0xff) << 16 |
|
(array[index + 1] & 0xff) << 16 |
|
||||||
(array[index + 2] & 0xff) << 8 |
|
(array[index + 2] & 0xff) << 8 |
|
||||||
(array[index + 3] & 0xff) << 0;
|
(array[index + 3] & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong(int index) {
|
public long getLong(int index) {
|
||||||
@ -80,25 +80,25 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
|
|||||||
((long) array[index + 4] & 0xff) << 24 |
|
((long) array[index + 4] & 0xff) << 24 |
|
||||||
((long) array[index + 5] & 0xff) << 16 |
|
((long) array[index + 5] & 0xff) << 16 |
|
||||||
((long) array[index + 6] & 0xff) << 8 |
|
((long) array[index + 6] & 0xff) << 8 |
|
||||||
((long) array[index + 7] & 0xff) << 0;
|
((long) array[index + 7] & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShort(int index, int value) {
|
public void setShort(int index, int value) {
|
||||||
array[index] = (byte) (value >>> 8);
|
array[index] = (byte) (value >>> 8);
|
||||||
array[index + 1] = (byte) (value >>> 0);
|
array[index + 1] = (byte) (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMedium(int index, int value) {
|
public void setMedium(int index, int value) {
|
||||||
array[index] = (byte) (value >>> 16);
|
array[index] = (byte) (value >>> 16);
|
||||||
array[index + 1] = (byte) (value >>> 8);
|
array[index + 1] = (byte) (value >>> 8);
|
||||||
array[index + 2] = (byte) (value >>> 0);
|
array[index + 2] = (byte) (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInt(int index, int value) {
|
public void setInt(int index, int value) {
|
||||||
array[index] = (byte) (value >>> 24);
|
array[index] = (byte) (value >>> 24);
|
||||||
array[index + 1] = (byte) (value >>> 16);
|
array[index + 1] = (byte) (value >>> 16);
|
||||||
array[index + 2] = (byte) (value >>> 8);
|
array[index + 2] = (byte) (value >>> 8);
|
||||||
array[index + 3] = (byte) (value >>> 0);
|
array[index + 3] = (byte) (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLong(int index, long 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 + 4] = (byte) (value >>> 24);
|
||||||
array[index + 5] = (byte) (value >>> 16);
|
array[index + 5] = (byte) (value >>> 16);
|
||||||
array[index + 6] = (byte) (value >>> 8);
|
array[index + 6] = (byte) (value >>> 8);
|
||||||
array[index + 7] = (byte) (value >>> 0);
|
array[index + 7] = (byte) (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChannelBuffer duplicate() {
|
public ChannelBuffer duplicate() {
|
||||||
|
@ -99,7 +99,7 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
|
|||||||
public int getUnsignedMedium(int index) {
|
public int getUnsignedMedium(int index) {
|
||||||
return (getByte(index) & 0xff) << 16 |
|
return (getByte(index) & 0xff) << 16 |
|
||||||
(getByte(index + 1) & 0xff) << 8 |
|
(getByte(index + 1) & 0xff) << 8 |
|
||||||
(getByte(index + 2) & 0xff) << 0;
|
(getByte(index + 2) & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInt(int index) {
|
public int getInt(int index) {
|
||||||
@ -158,7 +158,7 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
|
|||||||
public void setMedium(int index, int value) {
|
public void setMedium(int index, int value) {
|
||||||
setByte(index, (byte) (value >>> 16));
|
setByte(index, (byte) (value >>> 16));
|
||||||
setByte(index + 1, (byte) (value >>> 8));
|
setByte(index + 1, (byte) (value >>> 8));
|
||||||
setByte(index + 2, (byte) (value >>> 0));
|
setByte(index + 2, (byte) (value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInt(int index, int value) {
|
public void setInt(int index, int value) {
|
||||||
|
@ -108,7 +108,7 @@ public final class ChannelBuffers {
|
|||||||
final char[] DIGITS = "0123456789abcdef".toCharArray();
|
final char[] DIGITS = "0123456789abcdef".toCharArray();
|
||||||
for (int i = 0; i < 256; i ++) {
|
for (int i = 0; i < 256; i ++) {
|
||||||
HEXDUMP_TABLE[(i << 1) + 0] = DIGITS[i >>> 4 & 0x0F];
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,20 +60,20 @@ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getUnsignedMedium(int index) {
|
public int getUnsignedMedium(int index) {
|
||||||
return (array[index] & 0xff) << 0 |
|
return (array[index] & 0xff) |
|
||||||
(array[index + 1] & 0xff) << 8 |
|
(array[index + 1] & 0xff) << 8 |
|
||||||
(array[index + 2] & 0xff) << 16;
|
(array[index + 2] & 0xff) << 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInt(int index) {
|
public int getInt(int index) {
|
||||||
return (array[index] & 0xff) << 0 |
|
return (array[index] & 0xff) |
|
||||||
(array[index + 1] & 0xff) << 8 |
|
(array[index + 1] & 0xff) << 8 |
|
||||||
(array[index + 2] & 0xff) << 16 |
|
(array[index + 2] & 0xff) << 16 |
|
||||||
(array[index + 3] & 0xff) << 24;
|
(array[index + 3] & 0xff) << 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLong(int index) {
|
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 + 1] & 0xff) << 8 |
|
||||||
((long) array[index + 2] & 0xff) << 16 |
|
((long) array[index + 2] & 0xff) << 16 |
|
||||||
((long) array[index + 3] & 0xff) << 24 |
|
((long) array[index + 3] & 0xff) << 24 |
|
||||||
@ -84,25 +84,25 @@ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setShort(int index, int value) {
|
public void setShort(int index, int value) {
|
||||||
array[index] = (byte) (value >>> 0);
|
array[index] = (byte) (value);
|
||||||
array[index + 1] = (byte) (value >>> 8);
|
array[index + 1] = (byte) (value >>> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMedium(int index, int value) {
|
public void setMedium(int index, int value) {
|
||||||
array[index] = (byte) (value >>> 0);
|
array[index] = (byte) (value);
|
||||||
array[index + 1] = (byte) (value >>> 8);
|
array[index + 1] = (byte) (value >>> 8);
|
||||||
array[index + 2] = (byte) (value >>> 16);
|
array[index + 2] = (byte) (value >>> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInt(int index, int value) {
|
public void setInt(int index, int value) {
|
||||||
array[index] = (byte) (value >>> 0);
|
array[index] = (byte) (value);
|
||||||
array[index + 1] = (byte) (value >>> 8);
|
array[index + 1] = (byte) (value >>> 8);
|
||||||
array[index + 2] = (byte) (value >>> 16);
|
array[index + 2] = (byte) (value >>> 16);
|
||||||
array[index + 3] = (byte) (value >>> 24);
|
array[index + 3] = (byte) (value >>> 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLong(int index, long value) {
|
public void setLong(int index, long value) {
|
||||||
array[index] = (byte) (value >>> 0);
|
array[index] = (byte) (value);
|
||||||
array[index + 1] = (byte) (value >>> 8);
|
array[index + 1] = (byte) (value >>> 8);
|
||||||
array[index + 2] = (byte) (value >>> 16);
|
array[index + 2] = (byte) (value >>> 16);
|
||||||
array[index + 3] = (byte) (value >>> 24);
|
array[index + 3] = (byte) (value >>> 24);
|
||||||
|
@ -246,7 +246,7 @@ public class SpdyFrameEncoder implements ChannelDownstreamHandler {
|
|||||||
// Chromium Issue 79156
|
// Chromium Issue 79156
|
||||||
// SPDY setting ids are not written in network byte order
|
// SPDY setting ids are not written in network byte order
|
||||||
// Write id assuming the architecture is little endian
|
// 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 >> 8 & 0xFF);
|
||||||
frame.writeByte(id >> 16 & 0xFF);
|
frame.writeByte(id >> 16 & 0xFF);
|
||||||
frame.writeByte(ID_flags);
|
frame.writeByte(ID_flags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user