示例#1
0
  @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;
    }
  }
示例#2
0
 @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;
 }
示例#3
0
 @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;
 }