List of usage examples for io.netty.util.internal PlatformDependent BIG_ENDIAN_NATIVE_ORDER
boolean BIG_ENDIAN_NATIVE_ORDER
To view the source code for io.netty.util.internal PlatformDependent BIG_ENDIAN_NATIVE_ORDER.
Click Source Link
From source file:org.apache.activemq.artemis.utils.AbstractByteBufPool.java
License:Apache License
private static int byteBufHashCode(final ByteBuf byteBuf, final int offset, final int length) { final int intCount = length >>> 1; final int byteCount = length & 1; int hashCode = 1; int arrayIndex = offset; for (int i = 0; i < intCount; i++) { final short shortLE = byteBuf.getShortLE(arrayIndex); final short nativeShort = PlatformDependent.BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes(shortLE) : shortLE;//from www.ja v a 2 s .co m hashCode = 31 * hashCode + nativeShort; arrayIndex += 2; } for (int i = 0; i < byteCount; i++) { hashCode = 31 * hashCode + byteBuf.getByte(arrayIndex++); } return hashCode; }