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

Method wrappingIntDivFunction

libsolidity/codegen/YulUtilFunctions.cpp:880–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878}
879
880std::string YulUtilFunctions::wrappingIntDivFunction(IntegerType const& _type)
881{
882 std::string functionName = "wrapping_div_" + _type.identifier();
883 return m_functionCollector.createFunction(functionName, [&]() {
884 return
885 Whiskers(R"(
886 function <functionName>(x, y) -> r {
887 x := <cleanupFunction>(x)
888 y := <cleanupFunction>(y)
889 if iszero(y) { <error>() }
890 r := <?signed>s</signed>div(x, y)
891 }
892 )")
893 ("functionName", functionName)
894 ("cleanupFunction", cleanupFunction(_type))
895 ("signed", _type.isSigned())
896 ("error", panicFunction(PanicCode::DivisionByZero))
897 .render();
898 });
899}
900
901std::string YulUtilFunctions::intModFunction(IntegerType const& _type)
902{

Callers 1

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