sun.misc.Unsafe.getFloat()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中sun.misc.Unsafe.getFloat()方法的一些代码示例,展示了Unsafe.getFloat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unsafe.getFloat()方法的具体详情如下:
包路径:sun.misc.Unsafe
类名称:Unsafe
方法名:getFloat

Unsafe.getFloat介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

@Override
public float getFloat(long byteIndex) {
  return unsafe.getFloat(baseAdress + byteIndex);
}

代码示例来源:origin: neo4j/neo4j

public static float getFloat( Object obj, long offset )
{
  return unsafe.getFloat( obj, offset );
}

代码示例来源:origin: apache/ignite

/**
 * Gets float value from object field.
 *
 * @param obj Object.
 * @param fieldOff Field offset.
 * @return Float value from object field.
 */
public static float getFloatField(Object obj, long fieldOff) {
  return UNSAFE.getFloat(obj, fieldOff);
}

代码示例来源:origin: bytedeco/javacpp

@Override float getFloat(byte[] array, long offset) { return UNSAFE.getFloat(array, arrayOffset + offset); }
@Override void putFloat(byte[] array, long offset, float f) { UNSAFE.putFloat(array, arrayOffset + offset, f); }

代码示例来源:origin: bytedeco/javacpp

@Override float getFloat(long address) { return UNSAFE.getFloat(address); }
@Override void putFloat(long address, float f) { UNSAFE.putFloat(address, f); }

代码示例来源:origin: prestodb/presto

/**
 * Gets a 32-bit float at the specified absolute {@code index} in
 * this buffer.
 *
 * @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
 * {@code index + 4} is greater than {@code this.length()}
 */
public float getFloat(int index)
{
  checkIndexLength(index, SIZE_OF_FLOAT);
  return unsafe.getFloat(base, address + index);
}

代码示例来源:origin: prestodb/presto

public static float getFloat(byte[] bytes, int index)
{
  checkIndexLength(bytes.length, index, SIZE_OF_FLOAT);
  return unsafe.getFloat(bytes, ((long) ARRAY_BYTE_BASE_OFFSET) + index);
}

代码示例来源:origin: redisson/redisson

public final float getFloatValue(Object obj) throws IllegalAccessException {
  if (!isAndroid && memOffset >= 0) {
    return FSTUtil.unFlaggedUnsafe.getFloat(obj, memOffset);
  }
  return field.getFloat(obj);
}

代码示例来源:origin: redisson/redisson

@Override
public float getFloat(long byteIndex) {
  checkIndex(byteIndex,4);
  return unsafe.getFloat(base, off + byteIndex);
}

代码示例来源:origin: neo4j/neo4j

public static float getFloat( long address )
{
  checkAccess( address, Float.BYTES );
  return unsafe.getFloat( address );
}

代码示例来源:origin: apache/ignite

/**
 * Gets float value from given address. Alignment aware.
 *
 * @param addr Address.
 * @return Float value from given address.
 */
public static float getFloat(long addr) {
  return UNALIGNED ? UNSAFE.getFloat(addr) : Float.intBitsToFloat(getIntByByte(addr, BIG_ENDIAN));
}

代码示例来源:origin: apache/ignite

/**
 * Gets float value from byte array. Alignment aware.
 *
 * @param arr Object.
 * @param off Offset.
 * @return Float value from byte array.
 */
public static float getFloat(byte[] arr, long off) {
  return UNALIGNED ? UNSAFE.getFloat(arr, off) : Float.intBitsToFloat(getIntByByte(arr, off, BIG_ENDIAN));
}

代码示例来源:origin: real-logic/agrona

public float getFloat(final int index)
{
  boundsCheck0(index, SIZE_OF_FLOAT);
  return UNSAFE.getFloat(byteArray, ARRAY_BASE_OFFSET + index);
}

代码示例来源:origin: real-logic/agrona

public float getFloat(final long index)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_FLOAT);
  }
  return UNSAFE.getFloat(null, addressOffset + index);
}

代码示例来源:origin: real-logic/agrona

public float getFloat(final int index)
{
  if (SHOULD_BOUNDS_CHECK)
  {
    boundsCheck0(index, SIZE_OF_FLOAT);
  }
  return UNSAFE.getFloat(byteArray, addressOffset + index);
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public float getFloat(long byteIndex) {
  checkIndex(byteIndex,4);
  return unsafe.getFloat(base, off + byteIndex);
}

代码示例来源:origin: real-logic/agrona

public float getFloat(final int index)
{
  boundsCheck0(index, SIZE_OF_FLOAT);
  return UNSAFE.getFloat(null, address + index);
}

代码示例来源:origin: org.apache.avro/avro

@Override
 protected void write(Object object, Encoder out) throws IOException {
  out.writeFloat(UNSAFE.getFloat(object, offset));
 }
}

代码示例来源:origin: real-logic/agrona

public float getFloat(final int index, final ByteOrder byteOrder)
{
  boundsCheck0(index, SIZE_OF_FLOAT);
  if (NATIVE_BYTE_ORDER != byteOrder)
  {
    final int bits = UNSAFE.getInt(null, address + index);
    return Float.intBitsToFloat(Integer.reverseBytes(bits));
  }
  else
  {
    return UNSAFE.getFloat(null, address + index);
  }
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

public final float getFloatValue(Object obj) throws IllegalAccessException {
  if (!isAndroid && memOffset >= 0) {
    return FSTUtil.unFlaggedUnsafe.getFloat(obj, memOffset);
  }
  return field.getFloat(obj);
}

相关文章

Unsafe类方法