mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Cleanup
This commit is contained in:
parent
b1fcf023f9
commit
f25cd708ea
@ -47,7 +47,8 @@ struct LinearExpression
|
|||||||
static LinearExpression factorForVariable(size_t _index, rational _factor)
|
static LinearExpression factorForVariable(size_t _index, rational _factor)
|
||||||
{
|
{
|
||||||
LinearExpression result;
|
LinearExpression result;
|
||||||
result.resizeAndSet(_index, move(_factor));
|
result.resize(_index + 1);
|
||||||
|
result[_index] = move(_factor);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,17 +78,9 @@ struct LinearExpression
|
|||||||
|
|
||||||
size_t size() const { return factors.size(); }
|
size_t size() const { return factors.size(); }
|
||||||
|
|
||||||
void resize(size_t _size)
|
void resize(size_t _size, rational _default = {})
|
||||||
{
|
{
|
||||||
factors.resize(_size);
|
factors.resize(_size, std::move(_default));
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the factor at @a _index to @a _factor and enlarges if needed.
|
|
||||||
void resizeAndSet(size_t _index, rational _factor)
|
|
||||||
{
|
|
||||||
if (factors.size() <= _index)
|
|
||||||
factors.resize(_index + 1);
|
|
||||||
factors[_index] = move(_factor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @returns true if all factors of variables are zero.
|
/// @returns true if all factors of variables are zero.
|
||||||
|
Loading…
Reference in New Issue
Block a user