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

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

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

Unsafe.putFloat介绍

暂无

代码示例

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

@Override
public void putFloat(long byteIndex, float f) {
  unsafe.putFloat(baseAdress + byteIndex, f);
}

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

public static void putFloat( Object obj, long offset, float value )
{
  unsafe.putFloat( obj, offset, value );
}

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

/**
 * Stores float value into object field.
 *
 * @param obj Object.
 * @param fieldOff Field offset.
 * @param val Value.
 */
public static void putFloatField(Object obj, long fieldOff, float val) {
  UNSAFE.putFloat(obj, fieldOff, val);
}

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

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

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

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

代码示例来源:origin: com.google.protobuf/protobuf-java

@Override
public void putFloat(Object target, long offset, float value) {
 unsafe.putFloat(target, offset, value);
}

代码示例来源:origin: peter-lawrey/Java-Chronicle

@Override
public void writeFloat(float v) {
  UNSAFE.putFloat(position, v);
  position += 4;
}

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

public static void setFloat(byte[] bytes, int index, float value)
{
  checkIndexLength(bytes.length, index, SIZE_OF_FLOAT);
  unsafe.putFloat(bytes, ((long) ARRAY_BYTE_BASE_OFFSET) + index, value);
}

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

/**
 * Sets the specified 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 void setFloat(int index, float value)
{
  checkIndexLength(index, SIZE_OF_FLOAT);
  unsafe.putFloat(base, address + index, value);
}

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

public final void setFloatValue(Object newObj, float l) throws IllegalAccessException {
  if (!isAndroid && memOffset >= 0) {
    FSTUtil.unFlaggedUnsafe.putFloat(newObj, memOffset, l);
    return;
  }
  field.setFloat(newObj, l);
}

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

@Override
public void putFloat(long byteIndex, float f) {
  checkIndex(byteIndex,4);
  unsafe.putFloat(base, off + byteIndex, f);
}

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

public static void putFloat( long address, float value )
{
  checkAccess( address, Float.BYTES );
  unsafe.putFloat( address, value );
}

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

/**
 * Stores given float value. Alignment aware.
 *
 * @param addr Address.
 * @param val Value.
 */
public static void putFloat(long addr, float val) {
  if (UNALIGNED)
    UNSAFE.putFloat(addr, val);
  else
    putIntByByte(addr, Float.floatToIntBits(val), BIG_ENDIAN);
}

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

/**
 * Stores float value into byte array. Alignment aware.
 *
 * @param arr Byte array.
 * @param off Offset.
 * @param val Value.
 */
public static void putFloat(byte[] arr, long off, float val) {
  if (UNALIGNED)
    UNSAFE.putFloat(arr, off, val);
  else
    putIntByByte(arr, off, Float.floatToIntBits(val), BIG_ENDIAN);
}

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

public void putFloat(final int index, final float value)
{
  ensureCapacity(index, SIZE_OF_FLOAT);
  UNSAFE.putFloat(null, address + index, value);
}

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

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

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

public void putFloat(final int index, final float value)
{
  ensureCapacity(index, SIZE_OF_FLOAT);
  UNSAFE.putFloat(byteArray, ARRAY_BASE_OFFSET + index, value);
}

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

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

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

@Override
public void putFloat(long byteIndex, float f) {
  checkIndex(byteIndex,4);
  unsafe.putFloat(base, off + byteIndex, f);
}

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

public final void setFloatValue(Object newObj, float l) throws IllegalAccessException {
  if (!isAndroid && memOffset >= 0) {
    FSTUtil.unFlaggedUnsafe.putFloat(newObj, memOffset, l);
    return;
  }
  field.setFloat(newObj, l);
}

相关文章

Unsafe类方法