MCPcopy Create free account
hub / github.com/argotorg/solidity / intModFunction

Method intModFunction

libsolidity/codegen/YulUtilFunctions.cpp:901–920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899}
900
901std::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
922std::string YulUtilFunctions::overflowCheckedIntSubFunction(IntegerType const& _type)
923{

Callers 2

binaryOperationMethod · 0.80

Calls 5

WhiskersClass · 0.85
identifierMethod · 0.80
renderMethod · 0.80
createFunctionMethod · 0.45
isSignedMethod · 0.45

Tested by

no test coverage detected