本文整理汇总了Java中io.netty.util.internal.PlatformDependent.getShort方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformDependent.getShort方法的具体用法?Java PlatformDependent.getShort怎么用?Java PlatformDependent.getShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.netty.util.internal.PlatformDependent
的用法示例。
在下文中一共展示了PlatformDependent.getShort方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copy
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public void copy(long offsetAddr, int count) {
targetAlt.allocateNew(count);
final List<ArrowBuf> targetBuffers = target.getFieldBuffers();
final long max = offsetAddr + count * BUILD_RECORD_LINK_SIZE;
final long[] srcAddrs = this.srcAddrs;
long dstAddr = targetBuffers.get(VALUE_BUFFER_ORDINAL).memoryAddress();
for(long addr = offsetAddr; addr < max; addr += BUILD_RECORD_LINK_SIZE, dstAddr += SIZE){
final int batchIndex = PlatformDependent.getInt(addr);
if(batchIndex != SKIP){
final int batchOffset = PlatformDependent.getShort(addr + 4);
final long srcAddr = srcAddrs[batchIndex] + batchOffset * SIZE;
PlatformDependent.putInt(dstAddr, PlatformDependent.getInt(srcAddr));
}
}
}
示例2: copy
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public void copy(long offsetAddr, int count) {
if(allocateAsFixed){
targetAlt.allocateNew(count);
}
final long[] srcAddr = this.srcAddrs;
final long dstAddr = target.getFieldBuffers().get(bufferOrdinal).memoryAddress();
final long maxAddr = offsetAddr + count * BUILD_RECORD_LINK_SIZE;
int targetIndex = 0;
for(; offsetAddr < maxAddr; offsetAddr += BUILD_RECORD_LINK_SIZE, targetIndex++){
final int batchIndex = PlatformDependent.getInt(offsetAddr);
final int batchOffset = PlatformDependent.getShort(offsetAddr + 4);
final int byteValue = PlatformDependent.getByte(srcAddr[batchIndex] + (batchOffset >>> 3));
final int bitVal = ((byteValue >>> (batchOffset & 7)) & 1) << (targetIndex & 7);
final long addr = dstAddr + (targetIndex >>> 3);
PlatformDependent.putByte(addr, (byte) (PlatformDependent.getByte(addr) | bitVal));
}
}
示例3: copy
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public void copy(long offsetAddr, int count) {
if(allocateAsFixed){
targetAlt.allocateNew(count);
}
final long srcAddr = source.getFieldBuffers().get(bufferOrdinal).memoryAddress();
final long dstAddr = target.getFieldBuffers().get(bufferOrdinal).memoryAddress();
final long maxAddr = offsetAddr + count * STEP_SIZE;
int targetIndex = 0;
for(; offsetAddr < maxAddr; offsetAddr += STEP_SIZE, targetIndex++){
final int recordIndex = (char) PlatformDependent.getShort(offsetAddr);
final int byteValue = PlatformDependent.getByte(srcAddr + (recordIndex >>> 3));
final int bitVal = ((byteValue >>> (recordIndex & 7)) & 1) << (targetIndex & 7);
final long addr = dstAddr + (targetIndex >>> 3);
PlatformDependent.putByte(addr, (byte) (PlatformDependent.getByte(addr) | bitVal));
}
}
示例4: getShort
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public short getShort(int index) {
chk(index, 2);
short v = PlatformDependent.getShort(addr(index));
return v;
}
示例5: getShort
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public short getShort(int index) {
// wrapped.checkIndex(index, 2);
short v = PlatformDependent.getShort(addr(index));
return v;
}
示例6: setLinks
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private void setLinks(long indexAddr, final int buildBatch, final int records){
for(int incomingRecordIndex = 0; incomingRecordIndex < records; incomingRecordIndex++, indexAddr+=4){
final int hashTableIndex = PlatformDependent.getInt(indexAddr);
if(hashTableIndex == -1){
continue;
}
/* Use the global index returned by the hash table, to store
* the current record index and batch index. This will be used
* later when we probe and find a match.
*/
/* set the current record batch index and the index
* within the batch at the specified keyIndex. The keyIndex
* denotes the global index where the key for this record is
* stored in the hash table
*/
int hashTableBatch = hashTableIndex >>> 16;
int hashTableOffset = hashTableIndex & BATCH_MASK;
final ArrowBuf startIndex = startIndices.get(hashTableBatch);
final long startIndexMemStart = startIndex.memoryAddress() + hashTableOffset * HashTable.BUILD_RECORD_LINK_SIZE;
// If head of the list is empty, insert current index at this position
final int linkBatch = PlatformDependent.getInt(startIndexMemStart);
if (linkBatch == INDEX_EMPTY) {
PlatformDependent.putInt(startIndexMemStart, buildBatch);
PlatformDependent.putShort(startIndexMemStart + 4, (short) incomingRecordIndex);
} else {
/* Head of this list is not empty, if the first link
* is empty insert there
*/
hashTableBatch = linkBatch;
hashTableOffset = PlatformDependent.getShort(startIndexMemStart + 4);
final ArrowBuf firstLink = buildInfoList.get(hashTableBatch).getLinks();
final long firstLinkMemStart = firstLink.memoryAddress() + hashTableOffset * HashTable.BUILD_RECORD_LINK_SIZE;
final int firstLinkBatch = PlatformDependent.getInt(firstLinkMemStart);
if (firstLinkBatch == INDEX_EMPTY) {
PlatformDependent.putInt(firstLinkMemStart, buildBatch);
PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
} else {
/* Insert the current value as the first link and
* make the current first link as its next
*/
final short firstLinkOffset = PlatformDependent.getShort(firstLinkMemStart + 4);
final ArrowBuf nextLink = buildInfoList.get(buildBatch).getLinks();
final long nextLinkMemStart = nextLink.memoryAddress() + incomingRecordIndex * HashTable.BUILD_RECORD_LINK_SIZE;
PlatformDependent.putInt(nextLinkMemStart, firstLinkBatch);
PlatformDependent.putShort(nextLinkMemStart + 4, firstLinkOffset);
// As the existing (batch, offset) pair is moved out of firstLink into nextLink,
// now put the new (batch, offset) in the firstLink
PlatformDependent.putInt(firstLinkMemStart, buildBatch);
PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
}
}
}
}
示例7: setCurrentIndex
import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private void setCurrentIndex(final int hashTableIndex, final int buildBatch, final int incomingRecordIndex) throws SchemaChangeException {
/* set the current record batch index and the index
* within the batch at the specified keyIndex. The keyIndex
* denotes the global index where the key for this record is
* stored in the hash table
*/
int hashTableBatch = hashTableIndex / HashTable.BATCH_SIZE;
int hashTableOffset = hashTableIndex % HashTable.BATCH_SIZE;
final ArrowBuf startIndex = startIndices.get(hashTableBatch);
final long startIndexMemStart = startIndex.memoryAddress() + hashTableOffset * BUILD_RECORD_LINK_SIZE;
// If head of the list is empty, insert current index at this position
final int linkBatch = PlatformDependent.getInt(startIndexMemStart);
if (linkBatch == INDEX_EMPTY) {
PlatformDependent.putInt(startIndexMemStart, buildBatch);
PlatformDependent.putShort(startIndexMemStart + 4, (short) incomingRecordIndex);
} else {
/* Head of this list is not empty, if the first link
* is empty insert there
*/
hashTableBatch = linkBatch;
hashTableOffset = PlatformDependent.getShort(startIndexMemStart + 4);
final ArrowBuf firstLink = buildInfoList.get(hashTableBatch).getLinks();
final long firstLinkMemStart = firstLink.memoryAddress() + hashTableOffset * BUILD_RECORD_LINK_SIZE;
final int firstLinkBatch = PlatformDependent.getInt(firstLinkMemStart);
if (firstLinkBatch == INDEX_EMPTY) {
PlatformDependent.putInt(firstLinkMemStart, buildBatch);
PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
} else {
/* Insert the current value as the first link and
* make the current first link as its next
*/
final short firstLinkOffset = PlatformDependent.getShort(firstLinkMemStart + 4);
final ArrowBuf nextLink = buildInfoList.get(buildBatch).getLinks();
final long nextLinkMemStart = nextLink.memoryAddress() + incomingRecordIndex * BUILD_RECORD_LINK_SIZE;
PlatformDependent.putInt(nextLinkMemStart, firstLinkBatch);
PlatformDependent.putShort(nextLinkMemStart + 4, firstLinkOffset);
// As the existing (batch, offset) pair is moved out of firstLink into nextLink,
// now put the new (batch, offset) in the firstLink
PlatformDependent.putInt(firstLinkMemStart, buildBatch);
PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
}
}
}