mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use multiprecision::msb() in GasMeter and remove FixedHash dependency
This commit is contained in:
committed by
Daniel Kirchner
parent
3a17ca6331
commit
00f3c42d17
@@ -104,22 +104,6 @@ public:
|
||||
/// @returns a copy of the object's data as a byte vector.
|
||||
bytes asBytes() const { return bytes(data(), data() + N); }
|
||||
|
||||
/// Returns the index of the first bit set to one, or size() * 8 if no bits are set.
|
||||
inline unsigned firstBitSet() const
|
||||
{
|
||||
unsigned ret = 0;
|
||||
for (auto d: m_data)
|
||||
if (d)
|
||||
{
|
||||
for (;; ++ret, d <<= 1)
|
||||
if (d & 0x80)
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
ret += 8;
|
||||
return ret;
|
||||
}
|
||||
|
||||
private:
|
||||
std::array<uint8_t, N> m_data; ///< The binary data.
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user