void add(MutableBigInteger addend){
  int x=intLen;
  int y=addend.intLen;
  int resultLen=(intLen > addend.intLen ? intLen : addend.intLen);
  int[] result=(value.length < resultLen ? new int[resultLen] : value);
  int rstart=result.length - 1;
  long sum;
  long carry=0;
  while (x > 0 && y > 0) {
    x--;
    y--;
    sum=(value[x + offset] & LONG_MASK) + (addend.value[y + addend.offset] & LONG_MASK) + carry;
    result[rstart--]=(int)sum;
    carry=sum >>> 32;
  }
  while (x > 0) {
    x--;
    if (carry == 0 && result == value && rstart == (x + offset))     return;
    sum=(value[x + offset] & LONG_MASK) + carry;
    result[rstart--]=(int)sum;
    carry=sum >>> 32;
  }
  while (y > 0) {
    y--;
    sum=(addend.value[y + addend.offset] & LONG_MASK) + carry;
    result[rstart--]=(int)sum;
    carry=sum >>> 32;
  }
  if (carry > 0) {
    resultLen++;
    if (result.length < resultLen) {
      int temp[]=new int[resultLen];
      System.arraycopy(result,0,temp,1,result.length);
      temp[0]=1;
      result=temp;
    }
 else {
      result[rstart--]=1;
    }
  }
  value=result;
  intLen=resultLen;
  offset=result.length - resultLen;
}

void add ( MutableBigInteger addend ) { int x = intLen ; int y = addend . intLen ; int resultLen = ( intLen > addend . intLen ? intLen : addend . intLen ) ; int [ ] result = ( value . length < resultLen ? new int [ resultLen ] : value ) ; int rstart = result . length - 1 ; long sum ; long carry = 0 ; while ( x > 0 && y > 0 ) { x -- ; y -- ; sum = ( value [ x + offset ] & LONG_MASK ) + ( addend . value [ y + addend . offset ] & LONG_MASK ) + carry ; result [ rstart -- ] = ( int ) sum ; carry = sum > > > 32 ; } while ( x > 0 ) { x -- ; if ( carry == 0 && result == value && rstart == ( x + offset ) ) return ; sum = ( value [ x + offset ] & LONG_MASK ) + carry ; result [ rstart -- ] = ( int ) sum ; carry = sum > > > 32 ; } while ( y > 0 ) { y -- ; sum = ( addend . value [ y + addend . offset ] & LONG_MASK ) + carry ; result [ rstart -- ] = ( int ) sum ; carry = sum > > > 32 ; } if ( carry > 0 ) { resultLen ++ ; if ( result . length < resultLen ) { int temp [ ] = new int [ resultLen ] ; System . arraycopy ( result , 0 , temp , 1 , result . length ) ; temp [ 0 ] = 1 ; result = temp ; } else { result [ rstart -- ] = 1 ; } } value = result ; intLen = resultLen ; offset = result . length - resultLen ; }
adds the contents of two mutablebiginteger objects . the result is placed within this mutablebiginteger . the contents of the addend are not changed .
