public void grow(final long procId) { int delta, offset; if (procId < start) { // add to head long newStart = alignDown(procId); delta = (int)(start - newStart) >> ADDRESS_BITS_PER_WORD; offset = delta; start = newStart; } else { // Add to tail long newEnd = alignUp(procId + 1); delta = (int)(newEnd - getEnd()) >> ADDRESS_BITS_PER_WORD; offset = 0; } long[] newBitmap; int oldSize = updated.length; newBitmap = new long[oldSize + delta]; for (int i = 0; i < newBitmap.length; ++i) { newBitmap[i] = 0; } System.arraycopy(updated, 0, newBitmap, offset, oldSize); updated = newBitmap; newBitmap = new long[deleted.length + delta]; for (int i = 0; i < newBitmap.length; ++i) { newBitmap[i] = partial ? 0 : WORD_MASK; } System.arraycopy(deleted, 0, newBitmap, offset, oldSize); deleted = newBitmap; }
public void grow(final long procId) { int delta, offset; if (procId < start) { // add to head long newStart = alignDown(procId); delta = (int)(start - newStart) >> ADDRESS_BITS_PER_WORD; offset = delta; start = newStart; } else { // Add to tail long newEnd = alignUp(procId + 1); delta = (int)(newEnd - getEnd()) >> ADDRESS_BITS_PER_WORD; offset = 0; } long[] newBitmap; int oldSize = updated.length; newBitmap = new long[oldSize + delta]; for (int i = 0; i < newBitmap.length; ++i) { newBitmap[i] = 0; } System.arraycopy(updated, 0, newBitmap, offset, oldSize); updated = newBitmap; newBitmap = new long[deleted.length + delta]; for (int i = 0; i < newBitmap.length; ++i) { newBitmap[i] = partial ? 0 : WORD_MASK; } System.arraycopy(deleted, 0, newBitmap, offset, oldSize); deleted = newBitmap; }
public BitSetNode(final long procId, final boolean partial) { start = alignDown(procId); int count = 1; updated = new long[count]; deleted = new long[count]; for (int i = 0; i < count; ++i) { updated[i] = 0; deleted[i] = partial ? 0 : WORD_MASK; } this.partial = partial; updateState(procId, false); }
public BitSetNode(final long procId, final boolean partial) { start = alignDown(procId); int count = 1; updated = new long[count]; deleted = new long[count]; for (int i = 0; i < count; ++i) { updated[i] = 0; deleted[i] = partial ? 0 : WORD_MASK; } this.partial = partial; updateState(procId, false); }