Fix BigDecimal.equals() when scales are the same

The equals() code was assuming that smallValue is always
valid if this.bitLength < 64. The other instance may have
the same scale but have a larger bitLength.

Numbers might only be equal if their unscaled (big integer)
bit-length is the same. If bitLength < 64 then smallValue will
be set. If bitLength >= 64 then intVal must be used (and
smallValue will be zero or junk).

Bug: 25171838
Bug: https://code.google.com/p/android/issues/detail?id=191227
Change-Id: I2a5fd1d345544fad62c12a4b01fbb2fd8f2c7f69
2 files changed