/*
Реализация среды исполнения языка программирования
Объектно-ориентированный продвинутый векторный транслятор
Copyright © 2021, 2024 Малик Разработчик
Это свободная программа: вы можете перераспространять ее и/или изменять
ее на условиях Меньшей Стандартной общественной лицензии GNU в том виде,
в каком она была опубликована Фондом свободного программного обеспечения;
либо версии 3 лицензии, либо (по вашему выбору) любой более поздней версии.
Эта программа распространяется в надежде, что она будет полезной,
но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробнее см. в Меньшей Стандартной
общественной лицензии GNU.
Вы должны были получить копию Меньшей Стандартной общественной лицензии GNU
вместе с этой программой. Если это не так, см.
<https://www.gnu.org/licenses/>.
*/
package avt.lang;
import avt.lang.array.*;
public final class Array(Object)
{
public static void fill(boolean[] dst, int offset, int length, boolean value) { if(length > 0) fillByByte(dst, offset, length, value ? 1 : 0, 1); }
public static void fill(char[] dst, int offset, int length, char value) { if(length > 0) fillByShort(dst, offset, length, (short) value, 1); }
public static void fill(byte[] dst, int offset, int length, byte value) { if(length > 0) fillByByte(dst, offset, length, value, 1); }
public static void fill(byte2[] dst, int offset, int length, byte2 value) { if(length > 0) fillByByte(dst, offset, length, value, 2); }
public static void fill(byte4[] dst, int offset, int length, byte4 value) { if(length > 0) fillByByte(dst, offset, length, value, 4); }
public static void fill(byte8[] dst, int offset, int length, byte8 value) { if(length > 0) fillByByte(dst, offset, length, value, 8); }
public static void fill(short[] dst, int offset, int length, short value) { if(length > 0) fillByShort(dst, offset, length, value, 1); }
public static void fill(short2[] dst, int offset, int length, short2 value) { if(length > 0) fillByShort(dst, offset, length, value, 2); }
public static void fill(short4[] dst, int offset, int length, short4 value) { if(length > 0) fillByShort(dst, offset, length, value, 4); }
public static void fill(short8[] dst, int offset, int length, short8 value) { if(length > 0) fillByShort(dst, offset, length, value, 8); }
public static void fill(int[] dst, int offset, int length, int value) { if(length > 0) fillByInt(dst, offset, length, value, 1); }
public static void fill(int2[] dst, int offset, int length, int2 value) { if(length > 0) fillByInt(dst, offset, length, value, 2); }
public static void fill(int4[] dst, int offset, int length, int4 value) { if(length > 0) fillByInt(dst, offset, length, value, 4); }
public static void fill(int8[] dst, int offset, int length, int8 value) { if(length > 0) fillByInt(dst, offset, length, value, 8); }
public static void fill(long[] dst, int offset, int length, long value) { if(length > 0) fillByLong(dst, offset, length, value, 1); }
public static void fill(long2[] dst, int offset, int length, long2 value) { if(length > 0) fillByLong(dst, offset, length, value, 2); }
public static void fill(long4[] dst, int offset, int length, long4 value) { if(length > 0) fillByLong(dst, offset, length, value, 4); }
public static void fill(long8[] dst, int offset, int length, long8 value) { if(length > 0) fillByLong(dst, offset, length, value, 8); }
public static void fill(float[] dst, int offset, int length, float value) { if(length > 0) fillByFloat(dst, offset, length, value, 1); }
public static void fill(float2[] dst, int offset, int length, float2 value) { if(length > 0) fillByFloat(dst, offset, length, value, 2); }
public static void fill(float4[] dst, int offset, int length, float4 value) { if(length > 0) fillByFloat(dst, offset, length, value, 4); }
public static void fill(float8[] dst, int offset, int length, float8 value) { if(length > 0) fillByFloat(dst, offset, length, value, 8); }
public static void fill(double[] dst, int offset, int length, double value) { if(length > 0) fillByDouble(dst, offset, length, value, 1); }
public static void fill(double2[] dst, int offset, int length, double2 value) { if(length > 0) fillByDouble(dst, offset, length, value, 2); }
public static void fill(double4[] dst, int offset, int length, double4 value) { if(length > 0) fillByDouble(dst, offset, length, value, 4); }
public static void fill(double8[] dst, int offset, int length, double8 value) { if(length > 0) fillByDouble(dst, offset, length, value, 8); }
public static void fill(real[] dst, int offset, int length, real value) { if(length > 0) fillByReal(dst, offset, length, value); }
public static void fill(Object[] dst, int offset, int length, Object value) { if(length > 0) fillByRef(dst, offset, length, value); }
public static void copy(boolean[] src, int srcOffset, boolean[] dst, int dstOffset, int length) { if(length > 0) copyBy01(src, srcOffset, dst, dstOffset, length); }
public static void copy(char[] src, int srcOffset, char[] dst, int dstOffset, int length) { if(length > 0) copyBy02(src, srcOffset, dst, dstOffset, length); }
public static void copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int length) { if(length > 0) copyBy01(src, srcOffset, dst, dstOffset, length); }
public static void copy(byte2[] src, int srcOffset, byte2[] dst, int dstOffset, int length) { if(length > 0) copyBy02(src, srcOffset, dst, dstOffset, length); }
public static void copy(byte4[] src, int srcOffset, byte4[] dst, int dstOffset, int length) { if(length > 0) copyBy04(src, srcOffset, dst, dstOffset, length); }
public static void copy(byte8[] src, int srcOffset, byte8[] dst, int dstOffset, int length) { if(length > 0) copyBy08(src, srcOffset, dst, dstOffset, length); }
public static void copy(short[] src, int srcOffset, short[] dst, int dstOffset, int length) { if(length > 0) copyBy02(src, srcOffset, dst, dstOffset, length); }
public static void copy(short2[] src, int srcOffset, short2[] dst, int dstOffset, int length) { if(length > 0) copyBy04(src, srcOffset, dst, dstOffset, length); }
public static void copy(short4[] src, int srcOffset, short4[] dst, int dstOffset, int length) { if(length > 0) copyBy08(src, srcOffset, dst, dstOffset, length); }
public static void copy(short8[] src, int srcOffset, short8[] dst, int dstOffset, int length) { if(length > 0) copyBy16(src, srcOffset, dst, dstOffset, length); }
public static void copy(int[] src, int srcOffset, int[] dst, int dstOffset, int length) { if(length > 0) copyBy04(src, srcOffset, dst, dstOffset, length); }
public static void copy(int2[] src, int srcOffset, int2[] dst, int dstOffset, int length) { if(length > 0) copyBy08(src, srcOffset, dst, dstOffset, length); }
public static void copy(int4[] src, int srcOffset, int4[] dst, int dstOffset, int length) { if(length > 0) copyBy16(src, srcOffset, dst, dstOffset, length); }
public static void copy(int8[] src, int srcOffset, int8[] dst, int dstOffset, int length) { if(length > 0) copyBy32(src, srcOffset, dst, dstOffset, length); }
public static void copy(long[] src, int srcOffset, long[] dst, int dstOffset, int length) { if(length > 0) copyBy08(src, srcOffset, dst, dstOffset, length); }
public static void copy(long2[] src, int srcOffset, long2[] dst, int dstOffset, int length) { if(length > 0) copyBy16(src, srcOffset, dst, dstOffset, length); }
public static void copy(long4[] src, int srcOffset, long4[] dst, int dstOffset, int length) { if(length > 0) copyBy32(src, srcOffset, dst, dstOffset, length); }
public static void copy(long8[] src, int srcOffset, long8[] dst, int dstOffset, int length) { if(length > 0) copyBy64(src, srcOffset, dst, dstOffset, length); }
public static void copy(float[] src, int srcOffset, float[] dst, int dstOffset, int length) { if(length > 0) copyBy04(src, srcOffset, dst, dstOffset, length); }
public static void copy(float2[] src, int srcOffset, float2[] dst, int dstOffset, int length) { if(length > 0) copyBy08(src, srcOffset, dst, dstOffset, length); }
public static void copy(float4[] src, int srcOffset, float4[] dst, int dstOffset, int length) { if(length > 0) copyBy16(src, srcOffset, dst, dstOffset, length); }
public static void copy(float8[] src, int srcOffset, float8[] dst, int dstOffset, int length) { if(length > 0) copyBy32(src, srcOffset, dst, dstOffset, length); }
public static void copy(double[] src, int srcOffset, double[] dst, int dstOffset, int length) { if(length > 0) copyBy08(src, srcOffset, dst, dstOffset, length); }
public static void copy(double2[] src, int srcOffset, double2[] dst, int dstOffset, int length) { if(length > 0) copyBy16(src, srcOffset, dst, dstOffset, length); }
public static void copy(double4[] src, int srcOffset, double4[] dst, int dstOffset, int length) { if(length > 0) copyBy32(src, srcOffset, dst, dstOffset, length); }
public static void copy(double8[] src, int srcOffset, double8[] dst, int dstOffset, int length) { if(length > 0) copyBy64(src, srcOffset, dst, dstOffset, length); }
public static void copy(real[] src, int srcOffset, real[] dst, int dstOffset, int length) { if(length > 0) copyBy10(src, srcOffset, dst, dstOffset, length); }
public static void copy(Object[] src, int srcOffset, Object[] dst, int dstOffset, int length) { if(length > 0) copyByRefFast(src, srcOffset, dst, dstOffset, length); }
public static void copyRefs(Object[] src, int srcOffset, Object[] dst, int dstOffset, int length) { if(length > 0) copyByRefSlow(src, srcOffset, dst, dstOffset, length); }
public static void copyRaw(RawData src, long srcOffset, RawData dst, long dstOffset, long length) {
if(length > 0)
{
if(src == null)
{
throw new NullPointerException(String.format(package.getResourceString("null-pointer.argument"), new Object[] { "src" }));
}
if(dst == null)
{
throw new NullPointerException(String.format(package.getResourceString("null-pointer.argument"), new Object[] { "dst" }));
}
if(!(src instanceof avt.io.ByteArrayStream || src instanceof avt.lang.Struct || src.getClass().isArray()))
{
throw new IllegalArgumentException(String.format(package.getResourceString("illegal-argument.unsupported-type"), new Object[] { "src" }));
}
if(!(dst instanceof avt.io.ByteArrayStream || dst instanceof avt.lang.Struct || dst.getClass().isArray()))
{
throw new IllegalArgumentException(String.format(package.getResourceString("illegal-argument.unsupported-type"), new Object[] { "dst" }));
}
checkRawBounds(src, srcOffset, length);
checkRawBounds(dst, dstOffset, length);
long srcPointer = src.getPointer() + srcOffset;
long dstPointer = dst.getPointer() + dstOffset;
if(srcPointer >= dstPointer)
{
copyForwardByByte(srcPointer, dstPointer, length);
return;
}
long endOffset = length - 1L;
copyBackwardByByte(srcPointer + endOffset, dstPointer + endOffset, length);
}
}
public static void copyToRaw(char[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 1, dst, dstOffset, (long) length << 1); }
public static void copyToRaw(byte[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset, dst, dstOffset, (long) length); }
public static void copyToRaw(byte2[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 1, dst, dstOffset, (long) length << 1); }
public static void copyToRaw(byte4[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 2, dst, dstOffset, (long) length << 2); }
public static void copyToRaw(byte8[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 3, dst, dstOffset, (long) length << 3); }
public static void copyToRaw(short[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 1, dst, dstOffset, (long) length << 1); }
public static void copyToRaw(short2[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 2, dst, dstOffset, (long) length << 2); }
public static void copyToRaw(short4[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 3, dst, dstOffset, (long) length << 3); }
public static void copyToRaw(short8[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 4, dst, dstOffset, (long) length << 4); }
public static void copyToRaw(int[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 2, dst, dstOffset, (long) length << 2); }
public static void copyToRaw(int2[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 3, dst, dstOffset, (long) length << 3); }
public static void copyToRaw(int4[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 4, dst, dstOffset, (long) length << 4); }
public static void copyToRaw(int8[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 5, dst, dstOffset, (long) length << 5); }
public static void copyToRaw(long[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 3, dst, dstOffset, (long) length << 3); }
public static void copyToRaw(long2[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 4, dst, dstOffset, (long) length << 4); }
public static void copyToRaw(long4[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 5, dst, dstOffset, (long) length << 5); }
public static void copyToRaw(long8[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 6, dst, dstOffset, (long) length << 6); }
public static void copyToRaw(float[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 2, dst, dstOffset, (long) length << 2); }
public static void copyToRaw(float2[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 3, dst, dstOffset, (long) length << 3); }
public static void copyToRaw(float4[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 4, dst, dstOffset, (long) length << 4); }
public static void copyToRaw(float8[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 5, dst, dstOffset, (long) length << 5); }
public static void copyToRaw(double[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 3, dst, dstOffset, (long) length << 3); }
public static void copyToRaw(double2[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 4, dst, dstOffset, (long) length << 4); }
public static void copyToRaw(double4[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 5, dst, dstOffset, (long) length << 5); }
public static void copyToRaw(double8[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset << 6, dst, dstOffset, (long) length << 6); }
public static void copyToRaw(real[] src, int srcOffset, RawData dst, long dstOffset, int length) { if(length > 0) copyRaw(src, (long) srcOffset * 10L, dst, dstOffset, (long) length * 10L); }
public static void copyFromRaw(RawData src, long srcOffset, char[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 1, (long) length << 1); }
public static void copyFromRaw(RawData src, long srcOffset, byte[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset, (long) length); }
public static void copyFromRaw(RawData src, long srcOffset, byte2[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 1, (long) length << 1); }
public static void copyFromRaw(RawData src, long srcOffset, byte4[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 2, (long) length << 2); }
public static void copyFromRaw(RawData src, long srcOffset, byte8[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 3, (long) length << 3); }
public static void copyFromRaw(RawData src, long srcOffset, short[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 1, (long) length << 1); }
public static void copyFromRaw(RawData src, long srcOffset, short2[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 2, (long) length << 2); }
public static void copyFromRaw(RawData src, long srcOffset, short4[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 3, (long) length << 3); }
public static void copyFromRaw(RawData src, long srcOffset, short8[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 4, (long) length << 4); }
public static void copyFromRaw(RawData src, long srcOffset, int[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 2, (long) length << 2); }
public static void copyFromRaw(RawData src, long srcOffset, int2[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 3, (long) length << 3); }
public static void copyFromRaw(RawData src, long srcOffset, int4[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 4, (long) length << 4); }
public static void copyFromRaw(RawData src, long srcOffset, int8[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 5, (long) length << 5); }
public static void copyFromRaw(RawData src, long srcOffset, long[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 3, (long) length << 3); }
public static void copyFromRaw(RawData src, long srcOffset, long2[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 4, (long) length << 4); }
public static void copyFromRaw(RawData src, long srcOffset, long4[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 5, (long) length << 5); }
public static void copyFromRaw(RawData src, long srcOffset, long8[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 6, (long) length << 6); }
public static void copyFromRaw(RawData src, long srcOffset, float[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 2, (long) length << 2); }
public static void copyFromRaw(RawData src, long srcOffset, float2[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 3, (long) length << 3); }
public static void copyFromRaw(RawData src, long srcOffset, float4[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 4, (long) length << 4); }
public static void copyFromRaw(RawData src, long srcOffset, float8[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 5, (long) length << 5); }
public static void copyFromRaw(RawData src, long srcOffset, double[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 3, (long) length << 3); }
public static void copyFromRaw(RawData src, long srcOffset, double2[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 4, (long) length << 4); }
public static void copyFromRaw(RawData src, long srcOffset, double4[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 5, (long) length << 5); }
public static void copyFromRaw(RawData src, long srcOffset, double8[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset << 6, (long) length << 6); }
public static void copyFromRaw(RawData src, long srcOffset, real[] dst, int dstOffset, int length) { if(length > 0) copyRaw(src, srcOffset, dst, (long) dstOffset * 10L, (long) length * 10L); }
public static void checkBounds(Measureable array, int offset, int length) {
int alength = array.length;
int limit = offset + length;
if(limit < offset || limit > alength || offset < 0i || offset > alength)
{
throw new ArrayIndexOutOfBoundsException(package.getResourceString("out-of-bounds.array-index"));
}
}
public static void checkRawBounds(RawData rdata, long offset, long length) {
long rlength = rdata.getLength();
long limit = offset + length;
if(limit < offset || limit > rlength || offset < 0L || offset > rlength)
{
throw new RawDataOffsetOutOfBoundsException(package.getResourceString("out-of-bounds.raw-data-offset"));
}
}
public static native int indexOf(boolean value, boolean[] array, int startFromIndex, int maximumScanLength);
public static native int indexOf(int value, char[] array, int startFromIndex, int maximumScanLength);
public static native int indexOf(int value, byte[] array, int startFromIndex, int maximumScanLength);
public static native int indexOf(int value, short[] array, int startFromIndex, int maximumScanLength);
public static native int indexOf(int value, int[] array, int startFromIndex, int maximumScanLength);
public static native int indexOf(long value, long[] array, int startFromIndex, int maximumScanLength);
public static native int indexOf(Object value, Object[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(boolean value, boolean[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(int value, char[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(int value, byte[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(int value, short[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(int value, int[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(long value, long[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOf(Object value, Object[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(boolean value, boolean[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(int value, char[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(int value, byte[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(int value, short[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(int value, int[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(long value, long[] array, int startFromIndex, int maximumScanLength);
public static native int indexOfNon(Object value, Object[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(boolean value, boolean[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(int value, char[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(int value, byte[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(int value, short[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(int value, int[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(long value, long[] array, int startFromIndex, int maximumScanLength);
public static native int lastIndexOfNon(Object value, Object[] array, int startFromIndex, int maximumScanLength);
public static native int offsetOfEqual(boolean[] array0, int array0StartFromIndex, boolean[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfEqual(char[] array0, int array0StartFromIndex, char[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfEqual(byte[] array0, int array0StartFromIndex, byte[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfEqual(short[] array0, int array0StartFromIndex, short[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfEqual(int[] array0, int array0StartFromIndex, int[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfEqual(long[] array0, int array0StartFromIndex, long[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfEqual(Object[] array0, int array0StartFromIndex, Object[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(boolean[] array0, int array0StartFromIndex, boolean[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(char[] array0, int array0StartFromIndex, char[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(byte[] array0, int array0StartFromIndex, byte[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(short[] array0, int array0StartFromIndex, short[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(int[] array0, int array0StartFromIndex, int[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(long[] array0, int array0StartFromIndex, long[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int offsetOfNonEqual(Object[] array0, int array0StartFromIndex, Object[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(boolean[] array0, int array0StartFromIndex, boolean[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(char[] array0, int array0StartFromIndex, char[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(byte[] array0, int array0StartFromIndex, byte[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(short[] array0, int array0StartFromIndex, short[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(int[] array0, int array0StartFromIndex, int[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(long[] array0, int array0StartFromIndex, long[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfEqual(Object[] array0, int array0StartFromIndex, Object[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(boolean[] array0, int array0StartFromIndex, boolean[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(char[] array0, int array0StartFromIndex, char[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(byte[] array0, int array0StartFromIndex, byte[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(short[] array0, int array0StartFromIndex, short[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(int[] array0, int array0StartFromIndex, int[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(long[] array0, int array0StartFromIndex, long[] array1, int array1StartFromIndex, int maximumScanLength);
public static native int negOffsetOfNonEqual(Object[] array0, int array0StartFromIndex, Object[] array1, int array1StartFromIndex, int maximumScanLength);
public static int2 intersectBounds(Measureable array, int offset, int length) {
int alength = array.length;
int limit = offset + length;
if(limit < offset) return offset < 0i ? 0i : offset > alength ? alength : offset;
int beginIndex = offset < 0i ? 0i : offset > alength ? alength : offset;
int endIndex = limit < 0i ? 0i : limit > alength ? alength : limit;
return new int2 { beginIndex, endIndex - beginIndex };
}
public static long2 intersectRawBounds(RawData rdata, long offset, long length) {
long rlength = rdata.getLength();
long limit = offset + length;
if(limit < offset) return offset < 0L ? 0L : offset > rlength ? rlength : offset;
long beginOffset = offset < 0L ? 0L : offset > rlength ? rlength : offset;
long endOffset = limit < 0L ? 0L : limit > rlength ? rlength : limit;
return new long2 { beginOffset, endOffset - beginOffset };
}
private static void fillCheckArguments(Measureable dst, int offset, int length) {
if(dst == null)
{
throw new NullPointerException(String.format(package.getResourceString("null-pointer.argument"), new Object[] { "dst" }));
}
if(dst instanceof ImmutableMeasureable && !((ImmutableMeasureable) dst).isMutable())
{
throw new ImmutableStateException(package.getResourceString("illegal-state.immutable"));
}
checkBounds(dst, offset, length);
}
private static void fillByByte(Measureable dst, int offset, int length, byte8 value, int capacity) {
fillCheckArguments(dst, offset, length);
fillByByte(getArrayPointer(dst) + ((long) offset * (long) capacity), length, value, capacity);
}
private static void fillByShort(Measureable dst, int offset, int length, short8 value, int capacity) {
fillCheckArguments(dst, offset, length);
fillByShort(getArrayPointer(dst) + ((long) offset * (long) capacity << 1), length, value, capacity);
}
private static void fillByInt(Measureable dst, int offset, int length, int8 value, int capacity) {
fillCheckArguments(dst, offset, length);
fillByInt(getArrayPointer(dst) + ((long) offset * (long) capacity << 2), length, value, capacity);
}
private static void fillByLong(Measureable dst, int offset, int length, long8 value, int capacity) {
fillCheckArguments(dst, offset, length);
fillByLong(getArrayPointer(dst) + ((long) offset * (long) capacity << 3), length, value, capacity);
}
private static void fillByFloat(Measureable dst, int offset, int length, float8 value, int capacity) {
fillCheckArguments(dst, offset, length);
fillByFloat(getArrayPointer(dst) + ((long) offset * (long) capacity << 2), length, value, capacity);
}
private static void fillByDouble(Measureable dst, int offset, int length, double8 value, int capacity) {
fillCheckArguments(dst, offset, length);
fillByDouble(getArrayPointer(dst) + ((long) offset * (long) capacity << 3), length, value, capacity);
}
private static void fillByReal(Measureable dst, int offset, int length, real value) {
fillCheckArguments(dst, offset, length);
fillByReal(getArrayPointer(dst) + ((long) offset * 10L), length, value);
}
private static void fillByRef(Measureable dst, int offset, int length, Object value) {
fillCheckArguments(dst, offset, length);
((Object) dst).checkObjectArrayAssignable(value);
fillByRef(getArrayPointer(dst) + ((long) offset << 3), length, value);
}
private static native void fillByByte(long dstPointer, int length, byte8 value, int capacity);
private static native void fillByShort(long dstPointer, int length, short8 value, int capacity);
private static native void fillByInt(long dstPointer, int length, int8 value, int capacity);
private static native void fillByLong(long dstPointer, int length, long8 value, int capacity);
private static native void fillByFloat(long dstPointer, int length, float8 value, int capacity);
private static native void fillByDouble(long dstPointer, int length, double8 value, int capacity);
private static native void fillByReal(long dstPointer, int length, real value);
private static native void fillByRef(long dstPointer, int length, Object value);
private static void copyCheckArguments(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
if(src == null)
{
throw new NullPointerException(String.format(package.getResourceString("null-pointer.argument"), new Object[] { "src" }));
}
if(dst == null)
{
throw new NullPointerException(String.format(package.getResourceString("null-pointer.argument"), new Object[] { "dst" }));
}
if(dst instanceof ImmutableMeasureable && !((ImmutableMeasureable) dst).isMutable())
{
throw new ImmutableStateException(package.getResourceString("illegal-state.immutable"));
}
checkBounds(src, srcOffset, length);
checkBounds(dst, dstOffset, length);
}
private static void copyBy01(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByByte(srcPointer, dstPointer, longLength);
return;
}
long endOffset = longLength - 1L;
copyBackwardByByte(srcPointer + endOffset, dstPointer + endOffset, longLength);
}
private static void copyBy02(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 1);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 1);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByShort(srcPointer, dstPointer, longLength);
return;
}
long endOffset = longLength - 1L << 1;
copyBackwardByShort(srcPointer + endOffset, dstPointer + endOffset, longLength);
}
private static void copyBy04(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 2);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 2);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByInt(srcPointer, dstPointer, longLength);
return;
}
long endOffset = longLength - 1L << 2;
copyBackwardByInt(srcPointer + endOffset, dstPointer + endOffset, longLength);
}
private static void copyBy08(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 3);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 3);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByLong(srcPointer, dstPointer, longLength);
return;
}
long endOffset = longLength - 1L << 3;
copyBackwardByLong(srcPointer + endOffset, dstPointer + endOffset, longLength);
}
private static void copyBy10(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset * 10L);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset * 10L);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByShort(srcPointer, dstPointer, longLength * 5L);
return;
}
long endOffset = (longLength - 1L) * 10L + 8L;
copyBackwardByShort(srcPointer + endOffset, dstPointer + endOffset, longLength * 5L);
}
private static void copyBy16(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 4);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 4);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByLong(srcPointer, dstPointer, longLength << 1);
return;
}
long endOffset = (longLength - 1L << 4) + 0x08L;
copyBackwardByLong(srcPointer + endOffset, dstPointer + endOffset, longLength << 1);
}
private static void copyBy32(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 5);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 5);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByLong(srcPointer, dstPointer, longLength << 2);
return;
}
long endOffset = (longLength - 1L << 5) + 0x18L;
copyBackwardByLong(srcPointer + endOffset, dstPointer + endOffset, longLength << 2);
}
private static void copyBy64(Measureable src, int srcOffset, Measureable dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 6);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 6);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByLong(srcPointer, dstPointer, longLength << 3);
return;
}
long endOffset = (longLength - 1L << 6) + 0x38L;
copyBackwardByLong(srcPointer + endOffset, dstPointer + endOffset, longLength << 3);
}
private static void copyByRefFast(Object[] src, int srcOffset, Object[] dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
Class srcType = src.getClass().componentType;
Class dstType = dst.getClass().componentType;
if(!dstType.isAssignableFrom(srcType))
{
throw new ArrayStoreException(package.getResourceString("array-store")) { saving = srcType, required = dstType };
}
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 3);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 3);
long longLength = (long) length;
if(srcPointer >= dstPointer)
{
copyForwardByRef(srcPointer, dstPointer, longLength);
return;
}
long endOffset = longLength - 1L << 3;
copyBackwardByRef(srcPointer + endOffset, dstPointer + endOffset, longLength);
}
private static void copyByRefSlow(Object[] src, int srcOffset, Object[] dst, int dstOffset, int length) {
copyCheckArguments(src, srcOffset, dst, dstOffset, length);
long srcPointer = getArrayPointer(src) + ((long) srcOffset << 3);
long dstPointer = getArrayPointer(dst) + ((long) dstOffset << 3);
if(srcPointer >= dstPointer)
{
for(; length-- > 0; dst[dstOffset++] = src[srcOffset++]);
return;
}
for(srcOffset += length, dstOffset += length; length-- > 0; dst[--dstOffset] = src[--srcOffset]);
}
private static native void copyForwardByByte(long srcPointer, long dstPointer, long length);
private static native void copyForwardByShort(long srcPointer, long dstPointer, long length);
private static native void copyForwardByInt(long srcPointer, long dstPointer, long length);
private static native void copyForwardByLong(long srcPointer, long dstPointer, long length);
private static native void copyForwardByRef(long srcPointer, long dstPointer, long length);
private static native void copyBackwardByByte(long srcPointer, long dstPointer, long length);
private static native void copyBackwardByShort(long srcPointer, long dstPointer, long length);
private static native void copyBackwardByInt(long srcPointer, long dstPointer, long length);
private static native void copyBackwardByLong(long srcPointer, long dstPointer, long length);
private static native void copyBackwardByRef(long srcPointer, long dstPointer, long length);
private static native long getArrayPointer(Measureable array);
private int fldLength;
private int fldLengthZeroContinuation;
private int fldCapacity;
private int fldCapacityZeroContinuation;
private Struct fldParentStruct;
private long fldOffset;
private () { }
}