Example usage for io.netty.util.internal PlatformDependent putLong

List of usage examples for io.netty.util.internal PlatformDependent putLong

Introduction

In this page you can find the example usage for io.netty.util.internal PlatformDependent putLong.

Prototype

public static void putLong(byte[] data, int index, long value) 

Source Link

Usage

From source file:herddb.utils.Bytes.java

License:Apache License

public static void putLong(byte[] array, int index, long value) {
    if (HAS_UNSAFE && UNALIGNED) {
        PlatformDependent.putLong(array, index, BIG_ENDIAN_NATIVE_ORDER ? value : Long.reverseBytes(value));
    } else {//w ww  . j  a v  a2s .  c  o  m
        array[index] = (byte) (value >>> 56);
        array[index + 1] = (byte) (value >>> 48);
        array[index + 2] = (byte) (value >>> 40);
        array[index + 3] = (byte) (value >>> 32);
        array[index + 4] = (byte) (value >>> 24);
        array[index + 5] = (byte) (value >>> 16);
        array[index + 6] = (byte) (value >>> 8);
        array[index + 7] = (byte) value;
    }
}

From source file:org.apache.bookkeeper.bookie.storage.ldb.ArrayUtil.java

License:Apache License

public static void setLong(byte[] array, int index, long value) {
    if (HAS_UNSAFE && UNALIGNED) {
        PlatformDependent.putLong(array, index, BIG_ENDIAN_NATIVE_ORDER ? value : Long.reverseBytes(value));
    } else {//  w  w w .j a va  2 s .  co  m
        array[index] = (byte) (value >>> 56);
        array[index + 1] = (byte) (value >>> 48);
        array[index + 2] = (byte) (value >>> 40);
        array[index + 3] = (byte) (value >>> 32);
        array[index + 4] = (byte) (value >>> 24);
        array[index + 5] = (byte) (value >>> 16);
        array[index + 6] = (byte) (value >>> 8);
        array[index + 7] = (byte) value;
    }
}