public BoolArray(BoolArray array) { this.ordered = array.ordered; length = array.length; items = new bool[length]; JavaSystem.Arraycopy(array.items, 0, items, 0, length); }
public static bool[] Concat(bool[] array, int alen, bool[] other, int blen) { bool[] ret = new bool[alen + blen]; JavaSystem.Arraycopy(array, 0, ret, 0, alen); JavaSystem.Arraycopy(other, 0, ret, alen, blen); return(ret); }
public static long[] Concat(long[] array, int alen, long[] other, int blen) { long[] ret = new long[alen + blen]; JavaSystem.Arraycopy(array, 0, ret, 0, alen); JavaSystem.Arraycopy(other, 0, ret, alen, blen); return(ret); }
public static sbyte[] Concat(sbyte[] array, int alen, sbyte[] other, int blen) { sbyte[] ret = new sbyte[alen + blen]; JavaSystem.Arraycopy(array, 0, ret, 0, alen); JavaSystem.Arraycopy(other, 0, ret, alen, blen); return(ret); }
public override int[] ToGray(int[] buffer, int w, int h) { int size = w * h; int[] newResult = new int[size]; JavaSystem.Arraycopy(buffer, 0, newResult, 0, size); int alpha = 0xFF << 24; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int idx = w * i + j; int color = newResult[idx]; if (color != 0x00FFFFFF) { int red = ((color & 0x00FF0000) >> 16); int green = ((color & 0x0000FF00) >> 8); int blue = color & 0x000000FF; color = (red + green + blue) / 3; color = alpha | (color << 16) | (color << 8) | color; newResult[idx] = color; } } } return(newResult); }
private void EnsureCapacity() { if (size >= threshold) { Entry[] oldTable = valuesTable; int newCapacity = oldTable.Length * 2 + 1; Entry[] newMapTable = new Entry[newCapacity]; Entry[] newListTable = new Entry[newCapacity]; threshold = (int)(newCapacity * loadFactor); JavaSystem.Arraycopy(oldTable, 0, newListTable, 0, size); for (int i = 0; i < size; i++) { Entry old = oldTable[i]; int index = (old.hashCode & 0x7FFFFFFF) % newCapacity; Entry e = old; old = old.next; e.next = newMapTable[index]; newMapTable[index] = e; newListTable[i].index = i; } keysTable = newMapTable; valuesTable = newListTable; removed = 0; } }
public void RemoveRange(int start, int end) { if (end >= length) { throw new LSysException("end can't be >= length: " + end + " >= " + length); } if (start > end) { throw new LSysException("start can't be > end: " + start + " > " + end); } sbyte[] bytebuffer = this.bytebuffer; int count = end - start + 1; if (ordered) { JavaSystem.Arraycopy(bytebuffer, start + count, bytebuffer, start, length - (start + count)); } else { int lastIndex = this.length - 1; for (int i = 0; i < count; i++) { bytebuffer[start + i] = bytebuffer[lastIndex - i]; } } length -= count; }
public IntArray(IntArray array) { this.ordered = array.ordered; length = array.length; items = new int[length]; JavaSystem.Arraycopy(array.items, 0, items, 0, length); }
public static float[] Concat(float[] array, int alen, float[] other, int blen) { float[] ret = new float[alen + blen]; JavaSystem.Arraycopy(array, 0, ret, 0, alen); JavaSystem.Arraycopy(other, 0, ret, alen, blen); return(ret); }
public void setStreamParameters(byte[] pps, byte[] sps) { this.pps = pps; this.sps = sps; // A STAP-A NAL (NAL type 24) containing the sps and pps of the stream if (pps != null && sps != null) { // STAP-A NAL header + NALU 1 (SPS) size + NALU 2 (PPS) size = 5 bytes stapa = new byte[sps.Length + pps.Length + 5]; // STAP-A NAL header is 24 stapa[0] = 24; // Write NALU 1 size into the array (NALU 1 is the SPS). stapa[1] = (byte)(sps.Length >> 8); stapa[2] = (byte)(sps.Length & 0xFF); // Write NALU 2 size into the array (NALU 2 is the PPS). stapa[sps.Length + 3] = (byte)(pps.Length >> 8); stapa[sps.Length + 4] = (byte)(pps.Length & 0xFF); // Write NALU 1 into the array, then write NALU 2 into the array. JavaSystem.Arraycopy(sps, 0, stapa, 3, sps.Length); JavaSystem.Arraycopy(pps, 0, stapa, 5 + sps.Length, pps.Length); } }
public void AddPolyPoint(float x, float y) { for (int i = 0; i < numPoints; i++) { if ((pointsX[i] == x) && (pointsY[i] == y)) { y += offset; offset += EPSILON; } } if (numPoints == pointsX.Length) { float[] af = new float[numPoints * 2]; JavaSystem.Arraycopy(pointsX, 0, af, 0, numPoints); pointsX = af; af = new float[numPoints * 2]; JavaSystem.Arraycopy(pointsY, 0, af, 0, numPoints); pointsY = af; } pointsX[numPoints] = x; pointsY[numPoints] = y; numPoints++; }
public StrBuilder Delete(int start, int end) { if (this._values == null) { return(this); } if (start < 0) { start = 0; } if (end >= this._currentIndex) { this._currentIndex = start; this._dirty = true; return(this); } else if (end < 0) { end = 0; } int len = end - start; if (len > 0) { JavaSystem.Arraycopy(_values, start + len, _values, start, this._currentIndex - end); this._currentIndex -= len; this._dirty = true; } else if (len < 0) { throw new LSysException("index out of range: " + this._currentIndex); } return(this); }
public LongArray(LongArray array) { this.ordered = array.ordered; length = array.length; items = new long[length]; JavaSystem.Arraycopy(array.items, 0, items, 0, length); }
public FloatArray(FloatArray array) { this.ordered = array.ordered; length = array.length; items = new float[length]; JavaSystem.Arraycopy(array.items, 0, items, 0, length); }
public CharArray(CharArray array) { this.ordered = array.ordered; length = array.length; items = new char[length]; JavaSystem.Arraycopy(array.items, 0, items, 0, length); }
public static char[] Concat(char[] array, int alen, char[] other, int blen) { char[] ret = new char[alen + blen]; JavaSystem.Arraycopy(array, 0, ret, 0, alen); JavaSystem.Arraycopy(other, 0, ret, alen, blen); return(ret); }
public void RemoveRange(int start, int end) { if (end >= length) { throw new LSysException("end can't be >= length: " + end + " >= " + length); } if (start > end) { throw new LSysException("start can't be > end: " + start + " > " + end); } bool[] items = this.items; int count = end - start + 1; if (ordered) { JavaSystem.Arraycopy(items, start + count, items, start, length - (start + count)); } else { int lastIndex = this.length - 1; for (int i = 0; i < count; i++) { items[start + i] = items[lastIndex - i]; } } length -= count; }
protected sbyte[] Relength(int newlength) { sbyte[] newItems = new sbyte[newlength]; sbyte[] bytebuffer = this.bytebuffer; JavaSystem.Arraycopy(bytebuffer, 0, newItems, 0, MathUtils.Min(length, newItems.Length)); this.bytebuffer = newItems; return(newItems); }
protected bool[] Relength(int newlength) { bool[] newItems = new bool[newlength]; bool[] items = this.items; JavaSystem.Arraycopy(items, 0, newItems, 0, MathUtils.Min(length, newItems.Length)); this.items = newItems; return(newItems); }
public UIntArray(UIntArray array, UIntMode mode, bool little) { this.uintmode = mode; this.littleEndian = little; this.ordered = array.ordered; length = array.length; bytebuffer = new sbyte[length]; JavaSystem.Arraycopy(array.bytebuffer, 0, bytebuffer, 0, length); }
public override void Rot(float[] mat, float[] vecs, int offset, int numVecs, int stride) { for (int i = 0; i < numVecs; i++) { float[] vecPtr = new float[stride]; JavaSystem.Arraycopy(vecs, offset, vecPtr, 0, stride); Rot(mat, vecPtr); } }
public ARC4(sbyte[] key) { this.state = new sbyte[256]; int length = MathUtils.Min(256, key.Length); sbyte[] keyCopy = new sbyte[length]; JavaSystem.Arraycopy(key, 0, keyCopy, 0, length); this.key = keyCopy; Reset(); }
public void Write(sbyte[] buffer, int offset, int length) { if (length == 0) { return; } EnsureCapacity(length); JavaSystem.Arraycopy(buffer, offset, data, position, length); position += length; }
public int Read(sbyte[] buffer, int offset, int length) { if (length == 0) { return(0); } CheckAvailable(length); JavaSystem.Arraycopy(data, position, buffer, offset, length); position += length; return(length); }
public void AddAll(bool[] array, int offset, int len) { bool[] items = this.items; int lengthNeeded = this.length + len; if (lengthNeeded > items.Length) { items = Relength(MathUtils.Max(8, (int)(lengthNeeded * 1.75f))); } JavaSystem.Arraycopy(array, offset, items, this.length, len); this.length += len; }
public void AddAll(long[] array, int offset, int length) { long[] items = this.items; int lengthNeeded = length + length; if (lengthNeeded > items.Length) { items = Relength(MathUtils.Max(8, (int)(lengthNeeded * 1.75f))); } JavaSystem.Arraycopy(array, offset, items, length, length); length += length; }
public void AddAll(sbyte[] array, int offset, int length) { sbyte[] bytebuffer = this.bytebuffer; int lengthNeeded = length + length; if (lengthNeeded > bytebuffer.Length) { bytebuffer = Relength(MathUtils.Max(8, (int)(lengthNeeded * 1.75f))); } JavaSystem.Arraycopy(array, offset, bytebuffer, length, length); length += length; }
private Entry RemoveList(int index) { Entry e = valuesTable[index]; int numMoved = size - index - 1; if (numMoved > 0) { JavaSystem.Arraycopy(valuesTable, index + 1, valuesTable, index, numMoved); } valuesTable[--size] = null; removed++; return(e); }
public void SetLength(int length) { if (length != data.Length) { sbyte[] oldData = data; data = new sbyte[length]; JavaSystem.Arraycopy(oldData, 0, data, 0, MathUtils.Min(oldData.Length, length)); if (position > length) { position = length; } } }
private void UpdateIndex(int index, int length) { EnsureCapacity(MathUtils.Max(this._currentIndex, index) + length); if (index < this._currentIndex) { JavaSystem.Arraycopy(this._values, index, this._values, index + length, this._currentIndex - index); } else if (index > this._currentIndex) { CollectionUtils.Fill(this._values, this._currentIndex, index, ' '); } this._dirty = true; }