Split Common.h into Numeric.h.

This commit is contained in:
chriseth
2021-09-23 15:27:29 +02:00
parent c8e6ef9657
commit 1531863835
65 changed files with 318 additions and 215 deletions
@@ -27,6 +27,8 @@
#include <libsolidity/ast/TypeProvider.h>
#include <liblangutil/ErrorReporter.h>
#include <limits>
using namespace std;
using namespace solidity;
using namespace solidity::frontend;
+1 -1
View File
@@ -274,7 +274,7 @@ uint32_t ContractDefinition::interfaceId() const
{
uint32_t result{0};
for (auto const& function: interfaceFunctionList(false))
result ^= util::fromBigEndian<uint32_t>(function.first.ref());
result ^= fromBigEndian<uint32_t>(function.first.ref());
return result;
}
+2 -2
View File
@@ -1135,7 +1135,7 @@ IntegerType const* RationalNumberType::integerType() const
return nullptr;
else
return TypeProvider::integer(
max(util::numberEncodingSize(value), 1u) * 8,
max(numberEncodingSize(value), 1u) * 8,
negative ? IntegerType::Modifier::Signed : IntegerType::Modifier::Unsigned
);
}
@@ -1169,7 +1169,7 @@ FixedPointType const* RationalNumberType::fixedPointType() const
if (v > u256(-1))
return nullptr;
unsigned totalBits = max(util::numberEncodingSize(v), 1u) * 8;
unsigned totalBits = max(numberEncodingSize(v), 1u) * 8;
solAssert(totalBits <= 256, "");
return TypeProvider::fixedPoint(
+1
View File
@@ -29,6 +29,7 @@
#include <liblangutil/Exceptions.h>
#include <libsolutil/Common.h>
#include <libsolutil/Numeric.h>
#include <libsolutil/CommonIO.h>
#include <libsolutil/LazyInit.h>
#include <libsolutil/Result.h>
+1
View File
@@ -46,6 +46,7 @@
#include <stack>
#include <queue>
#include <utility>
#include <limits>
namespace solidity::frontend
{
+1 -1
View File
@@ -40,7 +40,7 @@ using namespace solidity::langutil;
using solidity::util::Whiskers;
using solidity::util::h256;
using solidity::util::toCompactHexWithPrefix;
using solidity::toCompactHexWithPrefix;
unsigned const CompilerUtils::dataStartOffset = 4;
size_t const CompilerUtils::freeMemoryPointer = 64;
+1
View File
@@ -52,6 +52,7 @@
#include <range/v3/view/reverse.hpp>
#include <algorithm>
#include <limits>
using namespace std;
using namespace solidity;
@@ -266,7 +266,7 @@ void IRGeneratorForStatements::initializeStateVar(VariableDeclaration const& _va
_varDecl.immutable() ?
IRLValue{*_varDecl.annotation().type, IRLValue::Immutable{&_varDecl}} :
IRLValue{*_varDecl.annotation().type, IRLValue::Storage{
util::toCompactHexWithPrefix(m_context.storageLocationOfStateVariable(_varDecl).first),
toCompactHexWithPrefix(m_context.storageLocationOfStateVariable(_varDecl).first),
m_context.storageLocationOfStateVariable(_varDecl).second
}},
*_varDecl.value()
+1 -1
View File
@@ -34,7 +34,7 @@
#include <range/v3/view.hpp>
#include <limits>
#include <deque>
using namespace std;
+4 -3
View File
@@ -78,10 +78,11 @@
#include <json/json.h>
#include <boost/algorithm/string/replace.hpp>
#include <utility>
#include <map>
#include <boost/algorithm/string/replace.hpp>
#include <limits>
using namespace std;
using namespace solidity;
@@ -1558,7 +1559,7 @@ public:
// The already encoded key-value pairs
ret += m_data;
// 16-bit big endian length
ret += util::toCompactBigEndian(size, 2);
ret += toCompactBigEndian(size, 2);
return ret;
}