/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }
/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }
/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }
/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }
/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }
/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }
/** * Batch hash code implementation that works at its best if {@code bytes} * contains a {@link org.apache.activemq.artemis.api.core.SimpleString} encoded. */ private static int hashCode(final ByteBuf bytes, final int offset, final int length) { if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { //if the platform allows it, the hash code could be computed without bounds checking if (bytes.hasArray()) { return onHeapHashCode(bytes.array(), bytes.arrayOffset() + offset, length); } else if (bytes.hasMemoryAddress()) { return offHeapHashCode(bytes.memoryAddress(), offset, length); } } return byteBufHashCode(bytes, offset, length); }