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:
JoelKatz
2012-10-12 09:21:29 -07:00
parent 92f004c47f
commit ab01c7c4a7

View File

@@ -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));
}