mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Correct amount serialization comments
This commit is contained in:
committed by
Nik Bougalis
parent
412a3ec710
commit
e0515b0015
@@ -623,12 +623,22 @@ STAmount::isEquivalent (const STBase& t) const
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// amount = value * [10 ^ offset]
|
||||
// amount = mValue * [10 ^ mOffset]
|
||||
// Representation range is 10^80 - 10^(-80).
|
||||
// On the wire, high 8 bits are (offset+142), low 56 bits are value.
|
||||
//
|
||||
// On the wire:
|
||||
// - high bit is 0 for XRP, 1 for issued currency
|
||||
// - next bit is 1 for positive, 0 for negative (except 0 issued currency, which
|
||||
// is a special case of 0x8000000000000000
|
||||
// - for issued currencies, the next 8 bits are (mOffset+97).
|
||||
// The +97 is so that this value is always positive.
|
||||
// - The remaining bits are significant digits (mantissa)
|
||||
// That's 54 bits for issued currency and 62 bits for native
|
||||
// (but XRP only needs 57 bits for the max value of 10^17 drops)
|
||||
//
|
||||
// Value is zero if amount is zero, otherwise value is 10^15 to (10^16 - 1)
|
||||
// inclusive.
|
||||
// mValue is zero if the amount is zero, otherwise it's within the range
|
||||
// 10^15 to (10^16 - 1) inclusive.
|
||||
// mOffset is in the range -96 to +80.
|
||||
void STAmount::canonicalize ()
|
||||
{
|
||||
if (isXRP (*this))
|
||||
|
||||
Reference in New Issue
Block a user