本文整理了Java中sun.misc.Unsafe.putLong()
方法的一些代码示例,展示了Unsafe.putLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unsafe.putLong()
方法的具体详情如下:
包路径:sun.misc.Unsafe
类名称:Unsafe
方法名:putLong
暂无
代码示例来源:origin: google/guava
@Override
public void putLongLittleEndian(byte[] array, int offset, long value) {
theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, value);
}
},
代码示例来源:origin: netty/netty
static void putLong(byte[] data, int index, long value) {
UNSAFE.putLong(data, BYTE_ARRAY_BASE_OFFSET + index, value);
}
代码示例来源:origin: netty/netty
static void putLong(long address, long value) {
UNSAFE.putLong(address, value);
}
代码示例来源:origin: prestodb/presto
@Override
public void putLongLittleEndian(byte[] array, int offset, long value) {
theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, value);
}
},
代码示例来源:origin: google/guava
@Override
public void putLongLittleEndian(byte[] array, int offset, long value) {
// Reverse the order of the bytes before storing, since we're on big-endian hardware.
long littleEndianValue = Long.reverseBytes(value);
theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, littleEndianValue);
}
};
代码示例来源:origin: prestodb/presto
void setLongUnchecked(int index, long value)
{
unsafe.putLong(base, address + index, value);
}
代码示例来源:origin: redisson/redisson
@Override
public void putLong(long byteIndex, long l) {
unsafe.putLong(baseAdress + byteIndex, l);
}
代码示例来源:origin: google/j2objc
@Override
public void putLongLittleEndian(byte[] array, int offset, long value) {
theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, value);
}
},
代码示例来源:origin: prestodb/presto
@Override
public void putLongLittleEndian(byte[] array, int offset, long value) {
// Reverse the order of the bytes before storing, since we're on big-endian hardware.
long littleEndianValue = Long.reverseBytes(value);
theUnsafe.putLong(array, (long) offset + BYTE_ARRAY_BASE_OFFSET, littleEndianValue);
}
};
代码示例来源:origin: redisson/redisson
public final void setLongValue(Object newObj, long i1) throws IllegalAccessException {
if (!isAndroid && memOffset >= 0) {
FSTUtil.unFlaggedUnsafe.putLong(newObj, memOffset, i1);
return;
}
field.setLong(newObj, i1);
}
代码示例来源:origin: prestodb/presto
public void clear(int offset, int length)
{
while (length >= SIZE_OF_LONG) {
unsafe.putLong(base, address + offset, 0);
offset += SIZE_OF_LONG;
length -= SIZE_OF_LONG;
}
while (length > 0) {
unsafe.putByte(base, address + offset, (byte) 0);
offset++;
length--;
}
}
代码示例来源:origin: neo4j/neo4j
/**
* Initialize (simulate calling the constructor of) the given DirectByteBuffer.
*/
public static void initDirectByteBuffer( Object dbb, long addr, int cap )
{
unsafe.putInt( dbb, directByteBufferMarkOffset, -1 );
unsafe.putInt( dbb, directByteBufferPositionOffset, 0 );
unsafe.putInt( dbb, directByteBufferLimitOffset, cap );
unsafe.putInt( dbb, directByteBufferCapacityOffset, cap );
unsafe.putLong( dbb, directByteBufferAddressOffset, addr );
}
代码示例来源:origin: prestodb/presto
public static void setLong(byte[] bytes, int index, long value)
{
checkIndexLength(bytes.length, index, SIZE_OF_LONG);
unsafe.putLong(bytes, ((long) ARRAY_BYTE_BASE_OFFSET) + index, value);
}
代码示例来源:origin: redisson/redisson
@Override
public void putLong(long byteIndex, long l) {
checkIndex(byteIndex,8);
unsafe.putLong(base, off + byteIndex, l);
}
代码示例来源:origin: apache/flink
@SuppressWarnings("restriction")
@Override
public void writeLong(long v) throws IOException {
if (this.position >= this.buffer.length - 7) {
resize(8);
}
if (LITTLE_ENDIAN) {
v = Long.reverseBytes(v);
}
UNSAFE.putLong(this.buffer, BASE_OFFSET + this.position, v);
this.position += 8;
}
代码示例来源:origin: apache/flink
@SuppressWarnings("restriction")
@Override
public void writeLong(long v) throws IOException {
if (this.position >= this.memory.length - 7) {
resize(8);
}
if (LITTLE_ENDIAN) {
v = Long.reverseBytes(v);
}
UNSAFE.putLong(this.memory, BASE_OFFSET + this.position, v);
this.position += 8;
}
代码示例来源:origin: neo4j/neo4j
public static void putLong( long address, long value )
{
checkAccess( address, Long.BYTES );
unsafe.putLong( address, value );
}
代码示例来源:origin: prestodb/presto
private static void setRawLong(Slice decimal, int index, long value)
{
unsafe.putLong(decimal.getBase(), decimal.getAddress() + SIZE_OF_LONG * index, value);
}
代码示例来源:origin: prestodb/presto
private static void setRawLong(Slice decimal, int index, long value)
{
unsafe.putLong(decimal.getBase(), decimal.getAddress() + SIZE_OF_LONG * index, value);
}
代码示例来源:origin: apache/flink
@SuppressWarnings("restriction")
@Override
public void writeLong(long v) throws IOException {
if (this.position >= this.buffer.length - 7) {
resize(8);
}
if (LITTLE_ENDIAN) {
v = Long.reverseBytes(v);
}
UNSAFE.putLong(this.buffer, BASE_OFFSET + this.position, v);
this.position += 8;
}
内容来源于网络,如有侵权,请联系作者删除!