当前位置: 首页>>代码示例>>Java>>正文


Java PlatformDependent.getInt方法代码示例

本文整理汇总了Java中io.netty.util.internal.PlatformDependent.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformDependent.getInt方法的具体用法?Java PlatformDependent.getInt怎么用?Java PlatformDependent.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.util.internal.PlatformDependent的用法示例。


在下文中一共展示了PlatformDependent.getInt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: accumulate

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
public void accumulate(final long memoryAddr, final int count) {
  final long maxAddr = memoryAddr + count * 4;
  List<ArrowBuf> buffers = getInput().getFieldBuffers();
  final long incomingBit = buffers.get(0).memoryAddress();
  final long incomingValue = buffers.get(1).memoryAddress();
  final long[] bitAddresses = this.bitAddresses;
  final long[] valueAddresses = this.valueAddresses;

  int incomingIndex = 0;
  for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){
    final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1;
    final double newVal = Double.longBitsToDouble(PlatformDependent.getLong(incomingValue + (incomingIndex * WIDTH)) * bitVal);
    final int tableIndex = PlatformDependent.getInt(ordinalAddr);
    int chunkIndex = tableIndex >>> LBlockHashTable.BITS_IN_CHUNK;
    int chunkOffset = tableIndex & LBlockHashTable.CHUNK_OFFSET_MASK;
    final long sumAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8;
    final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4);
    final int bitUpdateVal = bitVal << (chunkOffset & 31);
    PlatformDependent.putLong(sumAddr, Double.doubleToLongBits(Double.longBitsToDouble(PlatformDependent.getLong(sumAddr)) + newVal));
    PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:SumAccumulators.java

示例2: copy

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public void copy(long compoundAddr, final int srcStart, final int count) {
  copyWatch.start();

  final long[] dstAddrs = this.dstAddrs;

  long srcAddr = source.getFieldBuffers().get(VALUE_BUFFER_ORDINAL).memoryAddress() + srcStart * SIZE;

  final long max = compoundAddr + count * OFFSET_SIZE;
  for (; compoundAddr < max; compoundAddr +=OFFSET_SIZE, srcAddr += SIZE) {
    final int compoundIdx = PlatformDependent.getInt(compoundAddr);
    final int batchIdx = compoundIdx >>> 16;
    final int rowIdx = compoundIdx & 65535;

    final long dstAddr = dstAddrs[batchIdx] + rowIdx * SIZE;
    PlatformDependent.putLong(dstAddr, PlatformDependent.getLong(srcAddr));
    PlatformDependent.putLong(dstAddr + 8, PlatformDependent.getLong(srcAddr + 8));
  }

  copyWatch.stop();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:22,代码来源:MultiDestCopier.java

示例3: accumulate

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
public void accumulate(final long memoryAddr, final int count) {
  final long maxMemAddr = memoryAddr + count * 4;
  List<ArrowBuf> buffers = getInput().getFieldBuffers();
  final long incomaxgBit = buffers.get(0).memoryAddress();
  final long incomaxgValue = buffers.get(1).memoryAddress();
  final long[] bitAddresses = this.bitAddresses;
  final long[] valueAddresses = this.valueAddresses;

  int incomaxgIndex = 0;
  for(long ordinalAddr = memoryAddr; ordinalAddr < maxMemAddr; ordinalAddr += 4, incomaxgIndex++){

    final long newVal = PlatformDependent.getLong(incomaxgValue + (incomaxgIndex * WIDTH));
    final int tableIndex = PlatformDependent.getInt(ordinalAddr);
    int chunkIndex = tableIndex >>> LBlockHashTable.BITS_IN_CHUNK;
    int chunkOffset = tableIndex & LBlockHashTable.CHUNK_OFFSET_MASK;
    final long maxAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8;
    final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4);
    final int bitVal = (PlatformDependent.getByte(incomaxgBit + ((incomaxgIndex >>> 3))) >>> (incomaxgIndex & 7)) & 1;
    final int bitUpdateVal = bitVal << (chunkOffset & 31);
    PlatformDependent.putLong(maxAddr, max(PlatformDependent.getLong(maxAddr), newVal, bitVal));
    PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal);
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:MaxAccumulators.java

示例4: 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 * STEP_SIZE;
  int targetIndex = 0;
  for(; offsetAddr < maxAddr; offsetAddr += STEP_SIZE, targetIndex++){
    final int batchNOFF = PlatformDependent.getInt(offsetAddr);
    final int recordIndex = batchNOFF & MAX_BATCH;
    final int byteValue = PlatformDependent.getByte(srcAddr[batchNOFF >>> BATCH_BITS] + (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));
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:FieldBufferCopier4.java

示例5: memEqual

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private static final boolean memEqual(final long laddr, final long raddr, int len) {
  int n = len;
  long lPos = laddr;
  long rPos = raddr;

  while (n > 7) {
    long leftLong = PlatformDependent.getLong(lPos);
    long rightLong = PlatformDependent.getLong(rPos);
    if (leftLong != rightLong) {
      return false;
    }
    lPos += 8;
    rPos += 8;
    n -= 8;
  }
  while (n > 3) {
    int leftInt = PlatformDependent.getInt(lPos);
    int rightInt = PlatformDependent.getInt(rPos);
    if (leftInt != rightInt) {
      return false;
    }
    lPos += 4;
    rPos += 4;
    n -= 4;
  }
  while (n-- != 0) {
    byte leftByte = PlatformDependent.getByte(lPos);
    byte rightByte = PlatformDependent.getByte(rPos);
    if (leftByte != rightByte) {
      return false;
    }
    lPos++;
    rPos++;
  }
  return true;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:37,代码来源:LBlockHashTable.java

示例6: copy

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public void copy(long offsetAddr, int count) {
  dst.allocateNew();
  final long max = offsetAddr + count * BUILD_RECORD_LINK_SIZE;
  int target = 0;
  for(long addr = offsetAddr; addr < max; addr += BUILD_RECORD_LINK_SIZE) {
    final int batchIndex = PlatformDependent.getInt(addr);
    final int batchOffset = PlatformDependent.getShort(addr + 4);
    transfer[batchIndex].copyValueSafe(batchOffset, target);
    target++;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:FieldBufferCopier6.java

示例7: unpivotBits1

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
public static void unpivotBits1(long srcFixedAddr, int blockWidth, final long target, final int bitByteOffset, final int bitOffset, int count){

    final long startAddr = srcFixedAddr + bitByteOffset;
    long maxAddr = startAddr + (count * blockWidth);
    int targetIndex = 0;

    for(long srcAddr = startAddr; srcAddr < maxAddr; srcAddr += blockWidth, targetIndex++){
      final int byteValue = PlatformDependent.getInt(srcAddr);
      int bitVal = ((byteValue >>> bitOffset ) & 1 ) << (targetIndex & 31);
      final long addr = target + ((targetIndex >>> 5) * 4);
      PlatformDependent.putInt(addr, PlatformDependent.getInt(addr) | bitVal);
    }
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:Unpivots.java

示例8: accumulate

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
public void accumulate(final long offsetAddr, final int count){
  final long maxAddr = offsetAddr + count * 4;
  final long[] valueAddresses = this.valueAddresses;
  for(long ordinalAddr = offsetAddr; ordinalAddr < maxAddr; ordinalAddr += 4){
    final int tableIndex = PlatformDependent.getInt(ordinalAddr);
    final long countAddr = valueAddresses[tableIndex >>> LBlockHashTable.BITS_IN_CHUNK] + (tableIndex & LBlockHashTable.CHUNK_OFFSET_MASK) * 8;
    PlatformDependent.putLong(countAddr, PlatformDependent.getLong(countAddr) + 1);
  }

}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:CountOneAccumulator.java

示例9: getInt

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public int getInt(int index) {
  chk(index, 4);
  int v = PlatformDependent.getInt(addr(index));
  return v;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillBuf.java

示例10: 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);
      }
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:66,代码来源:VectorizedHashJoinOperator.java

示例11: getOrInsert

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private final int getOrInsert(final long keyFixedVectorAddr, final long keyVarVectorAddr, final int keyIndex, boolean insertNew) {
  final int blockWidth = pivot.getBlockWidth();
  final int capacity = this.capacity;
  final boolean fixedOnly = this.fixedOnly;
  final long keyFixedAddr = keyFixedVectorAddr + (blockWidth * keyIndex);

  final long[] tableControlAddresses = this.tableControlAddresses;
  final long[] tableFixedAddresses = this.tableFixedAddresses;
  final long[] initVariableAddresses = this.initVariableAddresses;

  final long keyVarAddr;
  final int keyVarLen;
  final int keyHash;
  final int dataWidth;

  if(fixedOnly){
    dataWidth = blockWidth;
    keyVarAddr = -1;
    keyVarLen = 0;
    keyHash = fixedKeyHashCode(keyFixedAddr, dataWidth);
  } else {
    dataWidth = blockWidth - VAR_OFFSET_SIZE;
    keyVarAddr = keyVarVectorAddr + PlatformDependent.getInt(keyFixedAddr + dataWidth);
    keyVarLen = PlatformDependent.getInt(keyVarAddr);
    keyHash = keyHashCode(keyFixedAddr, dataWidth, keyVarAddr, keyVarLen);
  }

  // start with a hash index.
  int controlIndex = keyHash & capacityMask;

  int controlChunkIndex = controlIndex >>> BITS_IN_CHUNK;
  long tableControlAddr = tableControlAddresses[controlChunkIndex] + ((controlIndex & CHUNK_OFFSET_MASK) * CONTROL_WIDTH);
  long control = PlatformDependent.getLong(tableControlAddr);

  keyAbsent: if (control != LFREE) {
    int dataChunkIndex;
    long tableDataAddr;

    int ordinal = (int) control;
    if (keyHash == (int) (control >>> 32)){
      dataChunkIndex = ordinal >>> BITS_IN_CHUNK;
      tableDataAddr = tableFixedAddresses[dataChunkIndex] + ((ordinal & CHUNK_OFFSET_MASK) * blockWidth);
      if(fixedKeyEquals(keyFixedAddr, tableDataAddr, dataWidth) && (fixedOnly || variableKeyEquals(keyVarAddr, initVariableAddresses[dataChunkIndex] + PlatformDependent.getInt(tableDataAddr + dataWidth), keyVarLen))){
        return ordinal;
      }
    }

    while (true) {
      controlIndex = (controlIndex - 1) & capacityMask;
      controlChunkIndex = controlIndex >>> BITS_IN_CHUNK;
      tableControlAddr = tableControlAddresses[controlChunkIndex] + ((controlIndex & CHUNK_OFFSET_MASK) * CONTROL_WIDTH);
      control = PlatformDependent.getLong(tableControlAddr);

      if (control == LFREE) {
        break keyAbsent;
      } else if(keyHash == (int) (control >>> 32)){
        ordinal = (int) control;
        dataChunkIndex = ordinal >>> BITS_IN_CHUNK;
        tableDataAddr = tableFixedAddresses[dataChunkIndex] + ((ordinal & CHUNK_OFFSET_MASK) * blockWidth);
        if(fixedKeyEquals(keyFixedAddr, tableDataAddr, dataWidth) && (fixedOnly || variableKeyEquals(keyVarAddr, initVariableAddresses[dataChunkIndex] + PlatformDependent.getInt(tableDataAddr + dataWidth), keyVarLen))){
          // key is present
          return ordinal;
        }
      }

    }
  }

  if(!insertNew){
    return -1;
  } else {
    // key is absent, let's insert.
    return insert(blockWidth, tableControlAddr, keyHash, dataWidth, keyFixedAddr, keyVarAddr, keyVarLen);
  }

}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:77,代码来源:LBlockHashTable.java

示例12: hashAddr

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
public static int hashAddr(long off, int len, int seed){

    long end = off + len;
    int h32;

    if (len >= 16) {
      long limit = end - 16;
      int v1 = seed + -1640531535 + -2048144777;
      int v2 = seed + -2048144777;
      int v3 = seed + 0;
      int v4 = seed - -1640531535;
      do {
        v1 += PlatformDependent.getInt(off) * -2048144777;
        v1 = Integer.rotateLeft(v1, 13);
        v1 *= -1640531535;
        off += 4;

        v2 += PlatformDependent.getInt(off) * -2048144777;
        v2 = Integer.rotateLeft(v2, 13);
        v2 *= -1640531535;
        off += 4;

        v3 += PlatformDependent.getInt(off) * -2048144777;
        v3 = Integer.rotateLeft(v3, 13);
        v3 *= -1640531535;
        off += 4;

        v4 += PlatformDependent.getInt(off) * -2048144777;
        v4 = Integer.rotateLeft(v4, 13);
        v4 *= -1640531535;
        off += 4;
      } while (off <= limit);

      h32 = Integer.rotateLeft(v1, 1) + Integer.rotateLeft(v2, 7) + Integer.rotateLeft(v3, 12)
          + Integer.rotateLeft(v4, 18);
    } else {
      h32 = seed + 374761393;
    }

    h32 += len;

    while (off <= end - 4) {
      h32 += PlatformDependent.getInt(off) * -1028477379;
      h32 = Integer.rotateLeft(h32, 17) * 668265263;
      off += 4;
    }

    while (off < end) {
      h32 += (PlatformDependent.getInt(off) & 0xFF) * 374761393;
      h32 = Integer.rotateLeft(h32, 11) * -1640531535;
      ++off;
    }

    h32 ^= h32 >>> 15;
    h32 *= -2048144777;
    h32 ^= h32 >>> 13;
    h32 *= -1028477379;
    h32 ^= h32 >>> 16;

    return h32;
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:62,代码来源:XXHashByteBuf.java


注:本文中的io.netty.util.internal.PlatformDependent.getInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。