mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
I believe our comparisons were broken for STAmount, for example, 0 XNS would
compare greater than 1 XNS! For non-native currencies, -2 would be greater than -1, which is wrong. This should fix it. We definitely need to make some test cases. Arthur, please look over this code and make sure I didn't miss something.
This commit is contained in:
@@ -478,10 +478,12 @@ void STAmount::setValue(const STAmount &a)
|
||||
|
||||
uint64 STAmount::toUInt64() const
|
||||
{ // makes them sort easily
|
||||
if (mIsNative)
|
||||
return mValue;
|
||||
if (mValue == 0)
|
||||
return 0x4000000000000000ull;
|
||||
if (mIsNegative)
|
||||
return mValue | (static_cast<uint64>(mOffset + 97) << (64 - 10));
|
||||
return ((cMaxNative + 1) - mValue) | (static_cast<uint64>(mOffset + 97) << (64 - 10));
|
||||
return mValue | (static_cast<uint64>(mOffset + 256 + 97) << (64 - 10));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user