| 899 | } |
| 900 | |
| 901 | std::string YulUtilFunctions::intModFunction(IntegerType const& _type) |
| 902 | { |
| 903 | std::string functionName = "mod_" + _type.identifier(); |
| 904 | return m_functionCollector.createFunction(functionName, [&]() { |
| 905 | return |
| 906 | Whiskers(R"( |
| 907 | function <functionName>(x, y) -> r { |
| 908 | x := <cleanupFunction>(x) |
| 909 | y := <cleanupFunction>(y) |
| 910 | if iszero(y) { <panic>() } |
| 911 | r := <?signed>s</signed>mod(x, y) |
| 912 | } |
| 913 | )") |
| 914 | ("functionName", functionName) |
| 915 | ("signed", _type.isSigned()) |
| 916 | ("cleanupFunction", cleanupFunction(_type)) |
| 917 | ("panic", panicFunction(PanicCode::DivisionByZero)) |
| 918 | .render(); |
| 919 | }); |
| 920 | } |
| 921 | |
| 922 | std::string YulUtilFunctions::overflowCheckedIntSubFunction(IntegerType const& _type) |
| 923 | { |
no test coverage detected