static void setByte(long address, int value) { PlatformDependent.putByte(address, (byte) value); }
static void setByte(byte[] array, int index, int value) { PlatformDependent.putByte(array, index, (byte) value); }
static void setLongLE(byte[] array, int index, long value) { if (UNALIGNED) { PlatformDependent.putLong(array, index, BIG_ENDIAN_NATIVE_ORDER ? Long.reverseBytes(value) : value); } else { PlatformDependent.putByte(array, index, (byte) value); PlatformDependent.putByte(array, index + 1, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 2, (byte) (value >>> 16)); PlatformDependent.putByte(array, index + 3, (byte) (value >>> 24)); PlatformDependent.putByte(array, index + 4, (byte) (value >>> 32)); PlatformDependent.putByte(array, index + 5, (byte) (value >>> 40)); PlatformDependent.putByte(array, index + 6, (byte) (value >>> 48)); PlatformDependent.putByte(array, index + 7, (byte) (value >>> 56)); } }
static void setLongLE(long address, long value) { if (UNALIGNED) { PlatformDependent.putLong(address, BIG_ENDIAN_NATIVE_ORDER ? Long.reverseBytes(value) : value); } else { PlatformDependent.putByte(address, (byte) value); PlatformDependent.putByte(address + 1, (byte) (value >>> 8)); PlatformDependent.putByte(address + 2, (byte) (value >>> 16)); PlatformDependent.putByte(address + 3, (byte) (value >>> 24)); PlatformDependent.putByte(address + 4, (byte) (value >>> 32)); PlatformDependent.putByte(address + 5, (byte) (value >>> 40)); PlatformDependent.putByte(address + 6, (byte) (value >>> 48)); PlatformDependent.putByte(address + 7, (byte) (value >>> 56)); } }
static void setLong(byte[] array, int index, long value) { if (UNALIGNED) { PlatformDependent.putLong(array, index, BIG_ENDIAN_NATIVE_ORDER ? value : Long.reverseBytes(value)); } else { PlatformDependent.putByte(array, index, (byte) (value >>> 56)); PlatformDependent.putByte(array, index + 1, (byte) (value >>> 48)); PlatformDependent.putByte(array, index + 2, (byte) (value >>> 40)); PlatformDependent.putByte(array, index + 3, (byte) (value >>> 32)); PlatformDependent.putByte(array, index + 4, (byte) (value >>> 24)); PlatformDependent.putByte(array, index + 5, (byte) (value >>> 16)); PlatformDependent.putByte(array, index + 6, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 7, (byte) value); } }
static void setLong(long address, long value) { if (UNALIGNED) { PlatformDependent.putLong(address, BIG_ENDIAN_NATIVE_ORDER ? value : Long.reverseBytes(value)); } else { PlatformDependent.putByte(address, (byte) (value >>> 56)); PlatformDependent.putByte(address + 1, (byte) (value >>> 48)); PlatformDependent.putByte(address + 2, (byte) (value >>> 40)); PlatformDependent.putByte(address + 3, (byte) (value >>> 32)); PlatformDependent.putByte(address + 4, (byte) (value >>> 24)); PlatformDependent.putByte(address + 5, (byte) (value >>> 16)); PlatformDependent.putByte(address + 6, (byte) (value >>> 8)); PlatformDependent.putByte(address + 7, (byte) value); } }
static void setInt(byte[] array, int index, int value) { if (UNALIGNED) { PlatformDependent.putInt(array, index, BIG_ENDIAN_NATIVE_ORDER ? value : Integer.reverseBytes(value)); } else { PlatformDependent.putByte(array, index, (byte) (value >>> 24)); PlatformDependent.putByte(array, index + 1, (byte) (value >>> 16)); PlatformDependent.putByte(array, index + 2, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 3, (byte) value); } }
static void setInt(long address, int value) { if (UNALIGNED) { PlatformDependent.putInt(address, BIG_ENDIAN_NATIVE_ORDER ? value : Integer.reverseBytes(value)); } else { PlatformDependent.putByte(address, (byte) (value >>> 24)); PlatformDependent.putByte(address + 1, (byte) (value >>> 16)); PlatformDependent.putByte(address + 2, (byte) (value >>> 8)); PlatformDependent.putByte(address + 3, (byte) value); } }
static void setIntLE(long address, int value) { if (UNALIGNED) { PlatformDependent.putInt(address, BIG_ENDIAN_NATIVE_ORDER ? Integer.reverseBytes(value) : value); } else { PlatformDependent.putByte(address, (byte) value); PlatformDependent.putByte(address + 1, (byte) (value >>> 8)); PlatformDependent.putByte(address + 2, (byte) (value >>> 16)); PlatformDependent.putByte(address + 3, (byte) (value >>> 24)); } }
static void setIntLE(byte[] array, int index, int value) { if (UNALIGNED) { PlatformDependent.putInt(array, index, BIG_ENDIAN_NATIVE_ORDER ? Integer.reverseBytes(value) : value); } else { PlatformDependent.putByte(array, index, (byte) value); PlatformDependent.putByte(array, index + 1, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 2, (byte) (value >>> 16)); PlatformDependent.putByte(array, index + 3, (byte) (value >>> 24)); } }
static void setMedium(long address, int value) { PlatformDependent.putByte(address, (byte) (value >>> 16)); if (UNALIGNED) { PlatformDependent.putShort(address + 1, BIG_ENDIAN_NATIVE_ORDER ? (short) value : Short.reverseBytes((short) value)); } else { PlatformDependent.putByte(address + 1, (byte) (value >>> 8)); PlatformDependent.putByte(address + 2, (byte) value); } }
static void setMediumLE(long address, int value) { PlatformDependent.putByte(address, (byte) value); if (UNALIGNED) { PlatformDependent.putShort(address + 1, BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes((short) (value >>> 8)) : (short) (value >>> 8)); } else { PlatformDependent.putByte(address + 1, (byte) (value >>> 8)); PlatformDependent.putByte(address + 2, (byte) (value >>> 16)); } }
static void setMedium(byte[] array, int index, int value) { PlatformDependent.putByte(array, index, (byte) (value >>> 16)); if (UNALIGNED) { PlatformDependent.putShort(array, index + 1, BIG_ENDIAN_NATIVE_ORDER ? (short) value : Short.reverseBytes((short) value)); } else { PlatformDependent.putByte(array, index + 1, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 2, (byte) value); } }
static void setMediumLE(byte[] array, int index, int value) { PlatformDependent.putByte(array, index, (byte) value); if (UNALIGNED) { PlatformDependent.putShort(array, index + 1, BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes((short) (value >>> 8)) : (short) (value >>> 8)); } else { PlatformDependent.putByte(array, index + 1, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 2, (byte) (value >>> 16)); } }
static void setShortLE(byte[] array, int index, int value) { if (UNALIGNED) { PlatformDependent.putShort(array, index, BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes((short) value) : (short) value); } else { PlatformDependent.putByte(array, index, (byte) value); PlatformDependent.putByte(array, index + 1, (byte) (value >>> 8)); } }
static void setShortLE(long address, int value) { if (UNALIGNED) { PlatformDependent.putShort( address, BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes((short) value) : (short) value); } else { PlatformDependent.putByte(address, (byte) value); PlatformDependent.putByte(address + 1, (byte) (value >>> 8)); } }
static void setShort(long address, int value) { if (UNALIGNED) { PlatformDependent.putShort( address, BIG_ENDIAN_NATIVE_ORDER ? (short) value : Short.reverseBytes((short) value)); } else { PlatformDependent.putByte(address, (byte) (value >>> 8)); PlatformDependent.putByte(address + 1, (byte) value); } }
static void setShort(byte[] array, int index, int value) { if (UNALIGNED) { PlatformDependent.putShort(array, index, BIG_ENDIAN_NATIVE_ORDER ? (short) value : Short.reverseBytes((short) value)); } else { PlatformDependent.putByte(array, index, (byte) (value >>> 8)); PlatformDependent.putByte(array, index + 1, (byte) value); } }
private static void setSingleBytes(final AbstractByteBuf buf, final long addr, final int index, final ByteBuffer src, final int length) { buf.checkIndex(index, length); final int srcPosition = src.position(); final int srcLimit = src.limit(); long dstAddr = addr; for (int srcIndex = srcPosition; srcIndex < srcLimit; srcIndex++) { final byte value = src.get(srcIndex); PlatformDependent.putByte(dstAddr, value); dstAddr++; } src.position(srcLimit); }
static void setShortLE(long address, int value) { if (UNALIGNED) { PlatformDependent.putShort( address, BIG_ENDIAN_NATIVE_ORDER ? Short.reverseBytes((short) value) : (short) value); } else { PlatformDependent.putByte(address, (byte) value); PlatformDependent.putByte(address + 1, (byte) (value >>> 8)); } }