Skip to content

Instantly share code, notes, and snippets.

@bshastry
Created February 28, 2024 05:50
Show Gist options
  • Save bshastry/c5044583d96ea45082e7a3942cbe2171 to your computer and use it in GitHub Desktop.
Save bshastry/c5044583d96ea45082e7a3942cbe2171 to your computer and use it in GitHub Desktop.
Experimental via IR ICE
pragma experimental solidity;
type uint256 = __builtin("word");
instantiation uint256: + {
function add(x, y) -> uint256 {
let a = uint256.rep(x);
let b = uint256.rep(y);
assembly {
a := add(a,b)
}
return uint256.abs(a);
}
}
function unreferenced(x:uint256) -> uint256
{
return x;
}
function f(x:uint256) -> uint256
{
return g(h(x));
}
function g(x:uint256) -> uint256
{
return x;
}
function h(x:uint256) -> uint256
{
return x;
}
contract C {
fallback() external {
let a: uint256->uint256 = f;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment