@Override public void swap(final Buffer other) { if (other instanceof LongArray) { long[] tmp = this.buffer; this.buffer = ((LongArray) other).buffer; ((LongArray) other).buffer = tmp; int tmp2 = this.actualSizeInWords; this.actualSizeInWords = ((LongArray) other).actualSizeInWords; ((LongArray) other).actualSizeInWords = tmp2; } else { long[] tmp = new long[other.sizeInWords()]; for (int i = 0; i < other.sizeInWords(); ++i) { tmp[i] = other.getWord(i); } int tmp2 = other.sizeInWords(); other.clear(); other.removeLastWord(); other.push_back(this, 0, this.sizeInWords()); this.buffer = tmp; this.actualSizeInWords = tmp2; } }
@Override public void negative_push_back(Buffer buffer, int start, int number) { resizeBuffer(number); for (int i = 0; i < number; ++i) { this.buffer[this.actualSizeInWords + i] = ~buffer.getWord(start + i); } this.actualSizeInWords += number; }
@Override public void push_back(Buffer buffer, int start, int number) { resizeBuffer(number); if (buffer instanceof LongArray) { long[] data = ((LongArray) buffer).buffer; System.arraycopy(data, start, this.buffer, this.actualSizeInWords, number); } else { for (int i = 0; i < number; ++i) { this.buffer[this.actualSizeInWords + i] = buffer.getWord(start + i); } } this.actualSizeInWords += number; }