List of usage examples for io.netty.util.internal PlatformDependent getShort
public static short getShort(long address)
From source file:org.apache.activemq.artemis.utils.AbstractByteBufPool.java
License:Apache License
private static int offHeapHashCode(final long address, 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(address + arrayIndex); arrayIndex += 2;// w ww . ja v a2 s . c o m } for (int i = 0; i < byteCount; i++) { hashCode = 31 * hashCode + PlatformDependent.getByte(address + arrayIndex++); } return hashCode; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * Get a radix key from a column values of the given tuple. * The sign of the column value should be considered. * * @param tuple//from ww w. ja va 2 s .c o m * @param sortKeyId * @param pass * @return */ static int ascNullLastSignConsidered16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_LAST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { // For negative values, the key should be 1 ~ 32768. For positive values, the key should be 32769 ~ 65536. key = PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) + _16BIT_SECOND_HALF_START_IDX; } return key; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * 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//from w w w . ja v a2 s . c o m * @param sortKeyId * @param pass * @return */ static int ascNullFirstSignConsidered16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_FIRST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { // For negative values, the key should be 1 ~ 32768. For positive values, the key should be 32769 ~ 65536. key = PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) + _16BIT_SECOND_HALF_START_IDX; } return key; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * 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//from w w w. j a va2s .c o m * @param sortKeyId * @param pass * @return */ static int descNullLastSignConsidered16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_LAST_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; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * 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/*from w ww.j a va 2 s . c o m*/ * @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; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * Get a 16-bit radix key from a column values of the given tuple. * The return key is an unsigned short value. * * @param tuple// ww w.j a va2 s . com * @param sortKeyId * @param pass * @return */ static int ascNullLast16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_LAST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = 1 + (PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & SHORT_UNSIGNED_MASK); } return key; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * Get a 16-bit radix key from a column values of the given tuple. * The return key is an unsigned short value. * * @param tuple//from w w w .j a v a 2 s .c o m * @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; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * Get a 16-bit radix key from a column values of the given tuple. * The return key is an unsigned short value. * * @param tuple/* w w w. j ava2 s .c o m*/ * @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; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * Get a 16-bit radix key from a column values of the given tuple. * The return key is an unsigned short value. * * @param tuple//from w w w . j a va 2 s .com * @param sortKeyId * @param pass * @return */ static int descNullFirst16RadixKey(UnSafeTuple tuple, int sortKeyId, int pass) { int key = _16BIT_NULL_FIRST_IDX; // for null if (!tuple.isBlankOrNull(sortKeyId)) { key = _16BIT_MAX_BIN_IDX - (PlatformDependent.getShort(getFieldAddr(tuple.address(), sortKeyId) + (pass)) & SHORT_UNSIGNED_MASK); } return key; }
From source file:org.apache.tajo.engine.planner.physical.RadixSort.java
License:Apache License
/** * 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//from ww w.j av a 2 s . c o m * @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; }