Skip to content

Instantly share code, notes, and snippets.

@leonardoalt
Created July 31, 2022 20:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardoalt/52693c9681faed3ddd60e96eed84b877 to your computer and use it in GitHub Desktop.
Save leonardoalt/52693c9681faed3ddd60e96eed84b877 to your computer and use it in GitHub Desktop.
function factorial_Yul_For(uint256 x) public pure returns(uint256){
assembly{
let result := 1
for {} iszero(iszero(x)) { x := sub(x, 1)} {
result := mul(result, x)
}
mstore(0,result)
return(0,0x20)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment