public static void appendHead(int idx, int trimHead, byte[] source, int sourceIdx, int sourceLen, int sourceMask,LocalHeap heap) { int targetIdx = makeSpaceForPrepend(idx,trimHead,sourceLen,heap); int i = sourceLen; while (--i>=0) { heap.data[targetIdx+i] = source[sourceMask&(sourceIdx+i)]; } }
public static void appendHead(int idx, int trimHead, byte[] source, int sourceIdx, int sourceLen, int sourceMask,LocalHeap heap) { int targetIdx = makeSpaceForPrepend(idx,trimHead,sourceLen,heap); int i = sourceLen; while (--i>=0) { heap.data[targetIdx+i] = source[sourceMask&(sourceIdx+i)]; } }
public static void appendHead(int idx, byte value, LocalHeap heap) { // everything is now ready to trim and copy. heap.data[makeSpaceForPrepend(idx,0,1,heap)] = value; }
public static void appendHead(int idx, int trimHead, byte[] source, int sourceIdx, int sourceLen, int sourceMask,LocalHeap heap) { int targetIdx = makeSpaceForPrepend(idx,trimHead,sourceLen,heap); int i = sourceLen; while (--i>=0) { heap.data[targetIdx+i] = source[sourceMask&(sourceIdx+i)]; } }
public static void appendHead(int idx, byte value, LocalHeap heap) { // everything is now ready to trim and copy. heap.data[makeSpaceForPrepend(idx,0,1,heap)] = value; }
public static void appendHead(int idx, byte value, LocalHeap heap) { // everything is now ready to trim and copy. heap.data[makeSpaceForPrepend(idx,0,1,heap)] = value; }
public static int makeSpaceForPrepend(int idx, int trimHead, int sourceLen, LocalHeap heap) { if (sourceLen>heap.dataLength) { throw new ArrayIndexOutOfBoundsException("Need to make space for "+sourceLen+" but the max size is "+heap.dataLength); } int textLength = sourceLen - trimHead; if (textLength < 0) { textLength = 0; } // if not room make room checking before first because thats where we // want to copy the head. int offset = idx << 2; heap.makeSpaceForPrepend(offset, textLength); // everything is now ready to trim and copy. // keep the max head append size int maxHead = heap.tat[offset + 2]; if (textLength > maxHead) { heap.tat[offset + 2] = textLength; } // everything is now ready to trim and copy. int newStart = heap.tat[offset] - textLength; if (newStart < 0) { newStart = 0; } heap.tat[offset] = newStart; return newStart; }
public static int makeSpaceForPrepend(int idx, int trimHead, int sourceLen, LocalHeap heap) { if (sourceLen>heap.dataLength) { throw new ArrayIndexOutOfBoundsException("Need to make space for "+sourceLen+" but the max size is "+heap.dataLength); } int textLength = sourceLen - trimHead; if (textLength < 0) { textLength = 0; } // if not room make room checking before first because thats where we // want to copy the head. int offset = idx << 2; heap.makeSpaceForPrepend(offset, textLength); // everything is now ready to trim and copy. // keep the max head append size int maxHead = heap.tat[offset + 2]; if (textLength > maxHead) { heap.tat[offset + 2] = textLength; } // everything is now ready to trim and copy. int newStart = heap.tat[offset] - textLength; if (newStart < 0) { newStart = 0; } heap.tat[offset] = newStart; return newStart; }
public static int makeSpaceForPrepend(int idx, int trimHead, int sourceLen, LocalHeap heap) { if (sourceLen>heap.dataLength) { throw new ArrayIndexOutOfBoundsException("Need to make space for "+sourceLen+" but the max size is "+heap.dataLength); } int textLength = sourceLen - trimHead; if (textLength < 0) { textLength = 0; } // if not room make room checking before first because thats where we // want to copy the head. int offset = idx << 2; heap.makeSpaceForPrepend(offset, textLength); // everything is now ready to trim and copy. // keep the max head append size int maxHead = heap.tat[offset + 2]; if (textLength > maxHead) { heap.tat[offset + 2] = textLength; } // everything is now ready to trim and copy. int newStart = heap.tat[offset] - textLength; if (newStart < 0) { newStart = 0; } heap.tat[offset] = newStart; return newStart; }