mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Minor fix.
This commit is contained in:
parent
e4b476cdbc
commit
55808b5487
@ -579,7 +579,7 @@ LinkerObject const& Assembly::assemble() const
|
|||||||
auto setDataSectionSize = [&](size_t _size) {
|
auto setDataSectionSize = [&](size_t _size) {
|
||||||
assertThrow(dataSectionSizeOffset.has_value(), AssemblyException, "");
|
assertThrow(dataSectionSizeOffset.has_value(), AssemblyException, "");
|
||||||
assertThrow(_size <= 0xFFFF, AssemblyException, "");
|
assertThrow(_size <= 0xFFFF, AssemblyException, "");
|
||||||
toBigEndian(static_cast<uint16_t>(_size), bytesRef(ret.bytecode.data() + *dataSectionSizeOffset, 2));
|
toBigEndian(_size, bytesRef(ret.bytecode.data() + *dataSectionSizeOffset, 2));
|
||||||
};
|
};
|
||||||
if (eof)
|
if (eof)
|
||||||
{
|
{
|
||||||
@ -863,8 +863,7 @@ LinkerObject const& Assembly::assemble() const
|
|||||||
AssemblyException,
|
AssemblyException,
|
||||||
"Relative jump too far"
|
"Relative jump too far"
|
||||||
);
|
);
|
||||||
uint16_t relativeOffset = static_cast<uint16_t>(pos - (bytecodeOffset + 2u));
|
toBigEndian(pos - (bytecodeOffset + 2u), bytesRef(ret.bytecode.data() + bytecodeOffset, 2));
|
||||||
toBigEndian(relativeOffset, bytesRef(ret.bytecode.data() + bytecodeOffset, 2));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -102,10 +102,10 @@ template <class T, class Out>
|
|||||||
inline void toBigEndian(T _val, Out&& o_out)
|
inline void toBigEndian(T _val, Out&& o_out)
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<bigint, T>::value || !std::numeric_limits<T>::is_signed, "only unsigned types or bigint supported"); //bigint does not carry sign bit on shift
|
static_assert(std::is_same<bigint, T>::value || !std::numeric_limits<T>::is_signed, "only unsigned types or bigint supported"); //bigint does not carry sign bit on shift
|
||||||
for (auto i = o_out.size(); i != 0; _val >>= 8, i--)
|
for (auto i = o_out.size(); i != 0u; _val >>= 8u, i--)
|
||||||
{
|
{
|
||||||
T v = _val & (T)0xff;
|
T v = _val & (T)0xffu;
|
||||||
o_out[i - 1] = (typename std::remove_reference_t<Out>::value_type)(uint8_t)v;
|
o_out[i - 1u] = (typename std::remove_reference_t<Out>::value_type)(uint8_t)v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user