mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-13 20:01:04 +00:00
Support solc v0.8.31 (#430)
- Support for solc v0.8.31. - Support for the `clz` Yul builtin. --------- Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.31;
|
||||
|
||||
/* runner.json
|
||||
{
|
||||
"differential": true,
|
||||
"actions": [
|
||||
{
|
||||
"Instantiate": {
|
||||
"code": {
|
||||
"Solidity": {
|
||||
"contract": "CountLeadingZeros"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
/// The EIP-7939 test vectors:
|
||||
/// https://eips.ethereum.org/EIPS/eip-7939#test-cases
|
||||
contract CountLeadingZeros {
|
||||
function clz(uint256 x) internal pure returns (uint256 r) {
|
||||
assembly {
|
||||
r := clz(x)
|
||||
}
|
||||
}
|
||||
|
||||
constructor() payable {
|
||||
assert(
|
||||
clz(0x000000000000000000000000000000000000000000000000000000000000000)
|
||||
== 0x0000000000000000000000000000000000000000000000000000000000000100
|
||||
);
|
||||
assert(
|
||||
clz(0x8000000000000000000000000000000000000000000000000000000000000000)
|
||||
== 0x0000000000000000000000000000000000000000000000000000000000000000
|
||||
);
|
||||
assert(
|
||||
clz(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
|
||||
== 0x0000000000000000000000000000000000000000000000000000000000000000
|
||||
);
|
||||
assert(
|
||||
clz(0x4000000000000000000000000000000000000000000000000000000000000000)
|
||||
== 0x0000000000000000000000000000000000000000000000000000000000000001
|
||||
);
|
||||
assert(
|
||||
clz(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
|
||||
== 0x0000000000000000000000000000000000000000000000000000000000000001
|
||||
);
|
||||
assert(
|
||||
clz(0x0000000000000000000000000000000000000000000000000000000000000001)
|
||||
== 0x00000000000000000000000000000000000000000000000000000000000000ff
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user