Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/283#discussion_r46348640 --- Diff: exec/memory/base/src/main/java/io/netty/buffer/UnsafeDirectLittleEndian.java --- @@ -89,156 +131,139 @@ public ByteBuf order(ByteOrder endianness) { } @Override - public double getDouble(int index) { - return Double.longBitsToDouble(getLong(index)); - } - - @Override - public char getChar(int index) { - return (char) getShort(index); - } - - @Override - public long getUnsignedInt(int index) { - return getInt(index) & 0xFFFFFFFFL; - } + public double getDouble(int index) { + return Double.longBitsToDouble(getLong(index)); + } - @Override - public int getInt(int index) { -// wrapped.checkIndex(index, 4); - int v = PlatformDependent.getInt(addr(index)); - return v; - } + @Override + public char getChar(int index) { + return (char) getShort(index); + } - @Override - public int getUnsignedShort(int index) { - return getShort(index) & 0xFFFF; - } + @Override + public long getUnsignedInt(int index) { + return getInt(index) & 0xFFFFFFFFL; + } - @Override - public short getShort(int index) { -// wrapped.checkIndex(index, 2); - short v = PlatformDependent.getShort(addr(index)); - return v; - } + @Override + public int getInt(int index) { + int v = PlatformDependent.getInt(addr(index)); + return v; + } - @Override - public ByteBuf setShort(int index, int value) { - wrapped.checkIndex(index, 2); - _setShort(index, value); - return this; - } + @Override + public int getUnsignedShort(int index) { + return getShort(index) & 0xFFFF; + } - @Override - public ByteBuf setInt(int index, int value) { - wrapped.checkIndex(index, 4); - _setInt(index, value); - return this; - } + @Override + public short getShort(int index) { + short v = PlatformDependent.getShort(addr(index)); + return v; + } - @Override - public ByteBuf setLong(int index, long value) { - wrapped.checkIndex(index, 8); - _setLong(index, value); - return this; - } + @Override + public ByteBuf setShort(int index, int value) { + wrapped.checkIndex(index, 2); + _setShort(index, value); + return this; + } - @Override - public ByteBuf setChar(int index, int value) { - setShort(index, value); - return this; - } + @Override + public ByteBuf setInt(int index, int value) { + wrapped.checkIndex(index, 4); + _setInt(index, value); + return this; + } - @Override - public ByteBuf setFloat(int index, float value) { - setInt(index, Float.floatToRawIntBits(value)); - return this; - } + @Override + public ByteBuf setLong(int index, long value) { + wrapped.checkIndex(index, 8); + _setLong(index, value); + return this; + } - @Override - public ByteBuf setDouble(int index, double value) { - setLong(index, Double.doubleToRawLongBits(value)); - return this; - } + @Override + public ByteBuf setChar(int index, int value) { + setShort(index, value); + return this; + } - @Override - public ByteBuf writeShort(int value) { - wrapped.ensureWritable(2); - _setShort(wrapped.writerIndex, value); - wrapped.writerIndex += 2; - return this; - } + @Override + public ByteBuf setFloat(int index, float value) { + setInt(index, Float.floatToRawIntBits(value)); + return this; + } - @Override - public ByteBuf writeInt(int value) { - wrapped.ensureWritable(4); - _setInt(wrapped.writerIndex, value); - wrapped.writerIndex += 4; - return this; - } + @Override + public ByteBuf setDouble(int index, double value) { + setLong(index, Double.doubleToRawLongBits(value)); + return this; + } - @Override - public ByteBuf writeLong(long value) { - wrapped.ensureWritable(8); - _setLong(wrapped.writerIndex, value); - wrapped.writerIndex += 8; - return this; - } + @Override + public ByteBuf writeShort(int value) { + wrapped.ensureWritable(2); + _setShort(wrapped.writerIndex, value); + wrapped.writerIndex += 2; + return this; + } - @Override - public ByteBuf writeChar(int value) { - writeShort(value); - return this; - } + @Override + public ByteBuf writeInt(int value) { + wrapped.ensureWritable(4); + _setInt(wrapped.writerIndex, value); + wrapped.writerIndex += 4; + return this; + } - @Override - public ByteBuf writeFloat(float value) { - writeInt(Float.floatToRawIntBits(value)); - return this; - } + @Override + public ByteBuf writeLong(long value) { + wrapped.ensureWritable(8); + _setLong(wrapped.writerIndex, value); + wrapped.writerIndex += 8; + return this; + } - @Override - public ByteBuf writeDouble(double value) { - writeLong(Double.doubleToRawLongBits(value)); - return this; - } + @Override + public ByteBuf writeChar(int value) { + writeShort(value); + return this; + } - private void _setShort(int index, int value) { - PlatformDependent.putShort(addr(index), (short) value); - } + @Override + public ByteBuf writeFloat(float value) { + writeInt(Float.floatToRawIntBits(value)); + return this; + } - private void _setInt(int index, int value) { - PlatformDependent.putInt(addr(index), value); - } + @Override + public ByteBuf writeDouble(double value) { + writeLong(Double.doubleToRawLongBits(value)); + return this; + } - private void _setLong(int index, long value) { - PlatformDependent.putLong(addr(index), value); - } + private void _setShort(int index, int value) { + PlatformDependent.putShort(addr(index), (short) value); + } - @Override - public byte getByte(int index) { - return PlatformDependent.getByte(addr(index)); - } + private void _setInt(int index, int value) { + PlatformDependent.putInt(addr(index), value); + } - @Override - public ByteBuf setByte(int index, int value) { - PlatformDependent.putByte(addr(index), (byte) value); - return this; - } + private void _setLong(int index, long value) { + PlatformDependent.putLong(addr(index), value); + } @Override - public boolean release() { - return release(1); + public byte getByte(int index) { + return PlatformDependent.getByte(addr(index)); } @Override - public boolean release(int decrement) { --- End diff -- this is the only place where `bufferCount`, `bufferSize` and `initCap` where used. Should we remove them from UDLE ? if yes, we should also remove the corresponding counters from `PooledByteBufAllocatorL`
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---