當前位置: 首頁>>代碼示例>>Java>>正文


Java PlatformDependent.putInt方法代碼示例

本文整理匯總了Java中io.netty.util.internal.PlatformDependent.putInt方法的典型用法代碼示例。如果您正苦於以下問題:Java PlatformDependent.putInt方法的具體用法?Java PlatformDependent.putInt怎麽用?Java PlatformDependent.putInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.netty.util.internal.PlatformDependent的用法示例。


在下文中一共展示了PlatformDependent.putInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: finishRecord

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public void finishRecord() {
  this.recordStart = characterData;

  if(fieldOpen){
    endField();
  }

  if(repeatedOffset >= repeatedOffsetMax){
    expandRepeatedOffsets();
  }

  int newOffset = ((int) (charLengthOffset - charLengthOffsetOriginal))/4;
  PlatformDependent.putInt(repeatedOffset, newOffset);
  repeatedOffset += 4;

  // if there were no defined fields, skip.
  if(fieldIndex > -1){
    batchIndex++;
    recordCount++;
  }


}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:25,代碼來源:RepeatedVarCharOutput.java

示例2: 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

示例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 float newVal = Float.intBitsToFloat(PlatformDependent.getInt(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) * 4;
    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.putInt(maxAddr, Float.floatToIntBits(max(Float.intBitsToFloat(PlatformDependent.getInt(maxAddr)), newVal, bitVal)));
    PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:23,代碼來源:MaxAccumulators.java

示例4: insert

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public void insert(long findAddr, int records) {
  try(FixedBlockVector fbv = new FixedBlockVector(allocator, buildPivot.getBlockWidth());
      VariableBlockVector var = new VariableBlockVector(allocator, buildPivot.getVariableCount());
      ){
    // first we pivot.
    pivotBuildWatch.start();
    Pivots.pivot(buildPivot, records, fbv, var);
    pivotBuildWatch.stop();
    final long keyFixedAddr = fbv.getMemoryAddress();
    final long keyVarAddr = var.getMemoryAddress();

    try(ArrowBuf offsets = allocator.buffer(records * 4)){
      insertWatch.start();
      for(int i =0 ; i < records; i++, findAddr += 4){
        PlatformDependent.putInt(findAddr, table.add(keyFixedAddr, keyVarAddr, i));
      }
      insertWatch.stop();
    }
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:22,代碼來源:BlockJoinTable.java

示例5: 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 float newVal = Float.intBitsToFloat(PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH)));
    final int tableIndex = PlatformDependent.getInt(ordinalAddr);
    int chunkIndex = tableIndex >>> LBlockHashTable.BITS_IN_CHUNK;
    int chunkOffset = tableIndex & LBlockHashTable.CHUNK_OFFSET_MASK;
    final long minAddr = valueAddresses[chunkIndex] + (chunkOffset) * 4;
    final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4);
    final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1;
    final int bitUpdateVal = bitVal << (chunkOffset & 31);
    PlatformDependent.putInt(minAddr, Float.floatToIntBits(min(Float.intBitsToFloat(PlatformDependent.getInt(minAddr)), newVal, bitVal)));
    PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:23,代碼來源:MinAccumulators.java

示例6: endField

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public boolean endField() {
  fieldOpen = false;

  if(charLengthOffset >= charLengthOffsetMax){
    expandVarCharOffsets();
  }

  int newOffset = (int) (characterData - characterDataOriginal);
  PlatformDependent.putInt(charLengthOffset, newOffset);
  charLengthOffset += 4;
  return fieldIndex < maxField;
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:14,代碼來源:RepeatedVarCharOutput.java

示例7: internalInit

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
private void internalInit(final int capacity) {
  // capacity is power of two.
  Preconditions.checkArgument((capacity & (capacity - 1)) == 0);
  initTimer.start();
  this.capacity = capacity;
  this.maxSize = !LHashCapacities.isMaxCapacity(capacity, false) ? config.maxSize(capacity) : capacity - 1;
  this.batches = (int) Math.ceil( capacity / (MAX_VALUES_PER_BATCH * 1.0d) );
  final FixedBlockVector[] newFixedBlocks = new FixedBlockVector[batches];
  tableFixedAddresses = new long[batches];
  capacityMask = capacity - 1;
  try(RollbackCloseable rollbackable = new RollbackCloseable()) {

    final long free = this.freeValue;
    for(int i =0; i < batches; i++){
      FixedBlockVector vector = new FixedBlockVector(allocator, BLOCK_WIDTH);
      rollbackable.add(vector);
      vector.allocateNoClear(MAX_VALUES_PER_BATCH);
      newFixedBlocks[i] = vector;
      tableFixedAddresses[i] = newFixedBlocks[i].getMemoryAddress();

      final long addr = newFixedBlocks[i].getMemoryAddress();
      final long max = addr + MAX_VALUES_PER_BATCH * BLOCK_WIDTH;
      for(long l = addr; l < max; l+= LBlockHashTableEight.BLOCK_WIDTH){
        PlatformDependent.putLong(l, free);
        PlatformDependent.putInt(l + KEY_WIDTH, NO_MATCH);
      }
    }

    this.fixedBlocks = newFixedBlocks;
    rollbackable.commit();
  } catch (Exception e) {
    throw Throwables.propagate(e);
  }
  initTimer.stop();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:36,代碼來源:LBlockHashTableEight.java

示例8: writeInt

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public ByteBuf writeInt(int value) {
  ensure(4);
  PlatformDependent.putInt(addr(writerIndex), value);
  writerIndex += 4;
  return this;
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:8,代碼來源:DrillBuf.java

示例9: copy

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public void copy(long offsetAddr, int count) {
  final List<ArrowBuf> sourceBuffers = source.getFieldBuffers();
  targetAlt.allocateNew(count);
  final List<ArrowBuf> targetBuffers = target.getFieldBuffers();
  final long max = offsetAddr + count * 2;
  final long srcAddr = sourceBuffers.get(VALUE_BUFFER_ORDINAL).memoryAddress();
  long dstAddr = targetBuffers.get(VALUE_BUFFER_ORDINAL).memoryAddress();
  for(long addr = offsetAddr; addr < max; addr += STEP_SIZE, dstAddr += SIZE){
    PlatformDependent.putInt(dstAddr, PlatformDependent.getInt(srcAddr + ((char) PlatformDependent.getShort(addr)) * SIZE));
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:13,代碼來源:FieldBufferCopier.java

示例10: writeWordwise

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
public static void writeWordwise(long addr, int length, long value) {
  if (length == 0) {
    return;
  }

  int nLong = length >>> 3;
  int nBytes = length & 7;
  for (int i = nLong; i > 0; i--) {
    PlatformDependent.putLong(addr, value);
    addr += 8;
  }
  if (nBytes == 4) {
    PlatformDependent.putInt(addr, (int) value);
    addr += 4;
  } else if (nBytes < 4) {
    for (int i = nBytes; i > 0; i--) {
      PlatformDependent.putByte(addr, (byte) value);
      addr++;
    }
  } else {
    PlatformDependent.putInt(addr, (int) value);
    addr += 4;
    for (int i = nBytes - 4; i > 0; i--) {
      PlatformDependent.putByte(addr, (byte) value);
      addr++;
    }
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:29,代碼來源:BaseSingleAccumulator.java

示例11: consumeData

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public void consumeData(int records) throws Exception {
  state.is(State.CAN_CONSUME);

  // ensure that none of the variable length vectors are corrupt so we can avoid doing bounds checking later.
  for(FieldVector v : vectorsToValidate){
    VariableLengthValidator.validateVariable(v, records);
  }

  try(FixedBlockVector fbv = new FixedBlockVector(context.getAllocator(), pivot.getBlockWidth());
      VariableBlockVector var = new VariableBlockVector(context.getAllocator(), pivot.getVariableCount());
      ){
    // first we pivot.
    pivotWatch.start();
    Pivots.pivot(pivot, records, fbv, var);
    pivotWatch.stop();
    final long keyFixedAddr = fbv.getMemoryAddress();
    final long keyVarAddr = var.getMemoryAddress();

    try(ArrowBuf offsets = context.getAllocator().buffer(records * 4)){
      long offsetAddr = offsets.memoryAddress();

      // then we add all values to table.
      insertWatch.start();
      for(int i = 0; i < records; i++, offsetAddr += 4){
        PlatformDependent.putInt(offsetAddr, table.add(keyFixedAddr, keyVarAddr, i));
      }
      insertWatch.stop();

      // then we do accumulators.
      accumulateWatch.start();
      accumulator.accumulate(offsets.memoryAddress(), records);
      accumulateWatch.stop();
    }

  }

  updateStats();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:40,代碼來源:VectorizedHashAggOperator.java

示例12: setInt

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
@Override
public ByteBuf setInt(int index, int value) {
  chk(index, 4);
  PlatformDependent.putInt(addr(index), value);
  return this;
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:7,代碼來源:DrillBuf.java

示例13: _setInt

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
private void _setInt(int index, int value) {
    PlatformDependent.putInt(addr(index), value);
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:4,代碼來源:UnsafeDirectLittleEndian.java

示例14: projectBuildNonMatches

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
/**
 * Project any remaining build items that were not matched. Only used when doing a FULL or RIGHT join.
 * @return Negative output if records were output but batch wasn't completed. Positive output if batch was completed.
 */
public int projectBuildNonMatches() {
  assert projectUnmatchedBuild;
  projectBuildNonMatchesWatch.start();

  final int targetRecordsPerBatch = this.targetRecordsPerBatch;

  int outputRecords = 0;
  int remainderBuildSetIndex = this.remainderBuildSetIndex;
  int nextClearIndex = remainderBuildElementIndex;

  BitSet currentBitset = remainderBuildSetIndex < 0 ? null : matches[remainderBuildSetIndex];

  final long projectBuildOffsetAddr = this.projectBuildOffsetAddr;
  // determine the next set of unmatched bits.
  while(outputRecords < targetRecordsPerBatch) {
    if(nextClearIndex == -1){
      // we need to move to the next bit set since the current one has no more matches.
      remainderBuildSetIndex++;
      if (remainderBuildSetIndex < matches.length) {

        currentBitset = matches[remainderBuildSetIndex];
        nextClearIndex = 0;
      } else {
        // no bitsets left.
        this.remainderBuildSetIndex = matches.length;
        remainderBuildSetIndex = -1;
        break;
      }
    }

    nextClearIndex = currentBitset.nextClearBit(nextClearIndex);
    if(nextClearIndex != -1){
      // the clear bit is only valid if it is within the batch it corresponds to.
      if(nextClearIndex >= matchMaxes[remainderBuildSetIndex]){
        nextClearIndex = -1;
      }else{
        final long projectBuildOffsetAddrStart = projectBuildOffsetAddr + outputRecords * BUILD_RECORD_LINK_SIZE;
        PlatformDependent.putInt(projectBuildOffsetAddrStart, remainderBuildSetIndex);
        PlatformDependent.putShort(projectBuildOffsetAddrStart + 4, (short)(nextClearIndex & HashTable.BATCH_MASK));
        outputRecords++;
        nextClearIndex++;
      }
    }
  }

  projectBuildNonMatchesWatch.stop();

  allocateOnlyProbe(outputRecords);
  projectBuild(projectBuildOffsetAddr, outputRecords);

  this.remainderBuildSetIndex = remainderBuildSetIndex;
  this.remainderBuildElementIndex = nextClearIndex;
  if(remainderBuildElementIndex == -1){
    return outputRecords;
  } else {
    return -outputRecords;
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:63,代碼來源:VectorizedProbe.java

示例15: getOrInsert

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
private final int getOrInsert(long key, boolean insertNew) {

    long free = this.freeValue;

    int index;
    long cur;
    final int capacityMask = this.capacityMask;
    index = SeparateKVLongKeyMixing.mix(key) & capacityMask;
    int chunkIndex = index >>> BITS_IN_CHUNK;
    int valueIndex = (index & CHUNK_OFFSET_MASK);
    long addr = tableFixedAddresses[chunkIndex] + (valueIndex * BLOCK_WIDTH);

    keyAbsent:
    if ((cur = PlatformDependent.getLong(addr)) != free) {
        if (cur == key) {
          return PlatformDependent.getInt(addr + KEY_WIDTH);
        } else {
          while (true) {
              index = (index - 1) & capacityMask;
              chunkIndex = index >>> BITS_IN_CHUNK;
              valueIndex = (index & CHUNK_OFFSET_MASK);
              addr = tableFixedAddresses[chunkIndex] + (valueIndex * BLOCK_WIDTH);

              if ((cur = PlatformDependent.getLong(addr)) == free) {
                break keyAbsent;
              } else if (cur == key) {
                return PlatformDependent.getInt(addr + KEY_WIDTH);
              }
            }
        }
    }


    if(!insertNew){
      return -1;
    } else {

      int insertedOrdinal = currentOrdinal;
      // set the ordinal value for the insertion.
      PlatformDependent.putLong(addr, key);
      PlatformDependent.putInt(addr + KEY_WIDTH, insertedOrdinal);

      currentOrdinal++;

      // check if can resize.
      if (currentOrdinal > maxSize) {
        tryRehashForExpansion();
      }

      return insertedOrdinal;
    }
  }
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:53,代碼來源:LBlockHashTableEight.java


注:本文中的io.netty.util.internal.PlatformDependent.putInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。