Java Code Examples for io.netty.util.internal.PlatformDependent#getShort()
The following examples show how to use
io.netty.util.internal.PlatformDependent#getShort() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatchGenerator.java From dremio-oss with Apache License 2.0 | 5 votes |
private VectorRange tryMatch(VectorRange input, VectorRange output) { final long buildOutputAddr = output.getBuildOffsets4(); final long probeOutputAddr = output.getProbeOffsets2(); long buildInputAddr = input.getBuildOffsets4(); long probeInputAddr = input.getProbeOffsets2(); final MatchedVector probeMatchVector = this.probeMatchVector; final boolean maintainMatches = this.maintainMatches; int outputIndex = 0; final int count = input.getCurrentOutputCount(); final IntRange currentInput = input.getCurrentOutputRange(); final int end = currentInput.end; for (int i = currentInput.start; i < end; i++) { final int compoundBuildIndex = PlatformDependent.getInt(buildInputAddr + i * 4); final short probeIndex = PlatformDependent.getShort(probeInputAddr + i * 2); if (doEval(probeIndex, compoundBuildIndex)) { if (maintainMatches) { // mark matching probe keys. probeMatchVector.mark(probeIndex); } // write output indices VectorRange.set(probeOutputAddr, buildOutputAddr, outputIndex, probeIndex, compoundBuildIndex); // increment output. outputIndex++; } } return output.resetRecordsFound(outputIndex); }
Example 2
Source File: AbstractByteBufPool.java From activemq-artemis with Apache License 2.0 | 5 votes |
private static int onHeapHashCode(final byte[] bytes, 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++) { hashCode = 31 * hashCode + PlatformDependent.getShort(bytes, arrayIndex); arrayIndex += 2; } for (int i = 0; i < byteCount; i++) { hashCode = 31 * hashCode + PlatformDependent.getByte(bytes, arrayIndex++); } return hashCode; }
Example 3
Source File: UnsafeByteBufUtil.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
static short getShort(long address) { if (UNALIGNED) { short v = PlatformDependent.getShort(address); return BIG_ENDIAN_NATIVE_ORDER ? v : Short.reverseBytes(v); } return (short) (PlatformDependent.getByte(address) << 8 | PlatformDependent.getByte(address + 1) & 0xff); }
Example 4
Source File: UnsafeByteBufUtil.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
static short getShortLE(long address) { if (UNALIGNED) { short v = PlatformDependent.getShort(address); return BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes(v) : v; } return (short) (PlatformDependent.getByte(address) & 0xff | PlatformDependent.getByte(address + 1) << 8); }
Example 5
Source File: UnsafeByteBufUtil.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
static short getShort(byte[] array, int index) { if (UNALIGNED) { short v = PlatformDependent.getShort(array, index); return BIG_ENDIAN_NATIVE_ORDER ? v : Short.reverseBytes(v); } return (short) (PlatformDependent.getByte(array, index) << 8 | PlatformDependent.getByte(array, index + 1) & 0xff); }
Example 6
Source File: ReadOnlyUnsafeDirectByteBuf.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected short _getShort(int index) { short v = PlatformDependent.getShort(addr(index)); return NATIVE_ORDER? v : Short.reverseBytes(v); }
Example 7
Source File: UnsafeDirectSwappedByteBuf.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override public short getShort(int index) { wrapped.checkIndex(index, 2); short v = PlatformDependent.getShort(addr(index)); return nativeByteOrder? v : Short.reverseBytes(v); }
Example 8
Source File: KQueueEventArray.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
short fflags(int index) { return PlatformDependent.getShort(getKEventOffset(index) + KQUEUE_FFLAGS_OFFSET); }
Example 9
Source File: KQueueEventArray.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
short filter(int index) { return PlatformDependent.getShort(getKEventOffset(index) + KQUEUE_FILTER_OFFSET); }
Example 10
Source File: KQueueEventArray.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
short flags(int index) { return PlatformDependent.getShort(getKEventOffset(index) + KQUEUE_FLAGS_OFFSET); }
Example 11
Source File: PooledUnsafeDirectByteBuf.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected short _getShort(int index) { short v = PlatformDependent.getShort(addr(index)); return NATIVE_ORDER? v : Short.reverseBytes(v); }
Example 12
Source File: UnpooledUnsafeDirectByteBuf.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected short _getShort(int index) { short v = PlatformDependent.getShort(addr(index)); return NATIVE_ORDER? v : Short.reverseBytes(v); }
Example 13
Source File: UnsafeDirectLittleEndian.java From Bats with Apache License 2.0 | 4 votes |
@Override public short getShort(int index) { short v = PlatformDependent.getShort(addr(index)); return v; }
Example 14
Source File: RadixSort.java From tajo with Apache License 2.0 | 3 votes |
/** * Get a 1-bit radix key from a column values of the given tuple. * The keys of 0 and 3 are reserved for null values. * * @param tuple * @param sortKeyId * @param pass * @return */ static int descNullLast1bRadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _1BIT_BIN_MAX_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = 1 + ((PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & 0xFFFF) >> 15); } return key; }
Example 15
Source File: RadixSort.java From tajo with Apache License 2.0 | 3 votes |
/** * Get a 1-bit radix key from a column values of the given tuple. * The keys of 0 and 3 are reserved for null values. * * @param tuple * @param sortKeyId * @param pass * @return */ static int ascNullLast1bRadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _1BIT_BIN_MAX_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = 2 - ((PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & 0xFFFF) >> 15); } return key; }
Example 16
Source File: RadixSort.java From tajo with Apache License 2.0 | 3 votes |
/** * Get a 16-bit radix key from a column values of the given tuple. * The return key is an unsigned short value. * * @param tuple * @param sortKeyId * @param pass * @return */ static int ascNullFirst16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_FIRST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = 1 + (PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & SHORT_UNSIGNED_MASK); } return key; }
Example 17
Source File: RadixSort.java From tajo with Apache License 2.0 | 3 votes |
/** * Get a 1-bit radix key from a column values of the given tuple. * The keys of 0 and 3 are reserved for null values. * * @param tuple * @param sortKeyId * @param pass * @return */ static int ascNullFirst1bRadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = 0; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = 2 - ((PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & 0xFFFF) >> 15); } return key; }
Example 18
Source File: DrillBuf.java From Bats with Apache License 2.0 | 3 votes |
/** * Read a short at position src+srcIndex and copy it to the dest+destIndex * * @param src source byte array * @param srcIndex source index * @param dest destination byte array * @param destIndex destination index */ public static void putShort(byte[] src, int srcIndex, byte[] dest, int destIndex) { check(srcIndex, SHORT_NUM_BYTES, src.length); check(destIndex,SHORT_NUM_BYTES, dest.length); short value = PlatformDependent.getShort(src, srcIndex); PlatformDependent.putShort(dest, destIndex, value); }
Example 19
Source File: RadixSort.java From tajo with Apache License 2.0 | 3 votes |
/** * Get a 16-bit radix key from a column values of the given tuple. * The sign of the column value should be considered. * * @param tuple * @param sortKeyId * @param pass * @return */ static int descNullFirstSignConsidered16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_FIRST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { // For positive values, the key should be 1 ~ 32768. For negative values, the key should be 32769 ~ 65536. key = _16BIT_FIRST_HALF_END_IDX - PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)); } return key; }
Example 20
Source File: RadixSort.java From tajo with Apache License 2.0 | 3 votes |
/** * Get a 16-bit radix key from a column values of the given tuple. * The return key is an unsigned short value. * * @param tuple * @param sortKeyId * @param pass * @return */ static int descNullLast16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_LAST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = _16BIT_MAX_BIN_IDX - (PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & SHORT_UNSIGNED_MASK); } return key; }