private int difference ( MutableBigInteger b ) { MutableBigInteger a = this ; int sign = a . compare ( b ) ; if ( sign == 0 ) return 0 ; if ( sign < 0 ) { MutableBigInteger tmp = a ; a = b ; b = tmp ; } long diff = 0 ; int x = a . intLen ; int y = b . intLen ; // Subtract common parts of both numbers while ( y > 0 ) { x -- ; y -- ; diff = ( a . value [ a . offset + x ] & LONG_MASK ) - ( b . value [ b . offset + y ] & LONG_MASK ) - ( ( int ) - ( diff >> 32 ) ) ; a . value [ a . offset + x ] = ( int ) diff ; } // Subtract remainder of longer number while ( x > 0 ) { x -- ; diff = ( a . value [ a . offset + x ] & LONG_MASK ) - ( ( int ) - ( diff >> 32 ) ) ; a . value [ a . offset + x ] = ( int ) diff ; } a . normalize ( ) ; return sign ; }
Subtracts the smaller of a and b from the larger and places the result into the larger . Returns 1 if the answer is in a - 1 if in b 0 if no operation was performed .