From 4d283b2b304f9c9a85fb6f03346cc7c9d0054daa Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Mon, 28 Mar 2016 13:36:48 -0500 Subject: currently what we have --- libsolidity/ast/Types.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index c9df0086..e4f2b035 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -817,7 +817,7 @@ shared_ptr ConstantNumberType::fixedPointType() const bool negative = (m_value < 0); //todo: change name bigint fractionalBits = fractionalBitsNeeded(); - + cout << "Total int: " << fractionalBits.str() << endl; if (negative && !fractionalSignBit) // convert to positive number of same bit requirements { integers = ((0 - integers) - 1) << 1; @@ -830,10 +830,14 @@ shared_ptr ConstantNumberType::fixedPointType() const return shared_ptr(); else { - unsigned totalBytesRequired = bytesRequired(fractionalBits) * 8; + cout << "m_value: " << m_value << endl; + cout << "Total int: " << fractionalBits.str() << endl; + unsigned fractionalBytesRequired = bytesRequired(fractionalBits) * 8; unsigned integerBytesRequired = bytesRequired(integers) * 8; + cout << "Fractional Bytes Required: " << fractionalBytesRequired << endl; + cout << "Integer Bytes Required: " << integerBytesRequired << endl << endl; return make_shared( - integerBytesRequired, totalBytesRequired - integerBytesRequired, + integerBytesRequired, fractionalBytesRequired, negative ? FixedPointType::Modifier::Signed : FixedPointType::Modifier::Unsigned ); } @@ -842,7 +846,7 @@ shared_ptr ConstantNumberType::fixedPointType() const //todo: change name of function bigint ConstantNumberType::fractionalBitsNeeded() const { - auto value = m_value; + auto value = m_value - wholeNumbers(); for (unsigned fractionalBits = 0; value < boost::multiprecision::pow(bigint(2), 256); fractionalBits += 8, value *= 10) { if (value.denominator() == 1) -- cgit v1.2.3