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

Method negateNumberWrappingFunction

libsolidity/codegen/YulUtilFunctions.cpp:4281–4298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4279}
4280
4281std::string YulUtilFunctions::negateNumberWrappingFunction(Type const& _type)
4282{
4283 solAssert(_type.category() == Type::Category::Integer, "");
4284 IntegerType const& type = dynamic_cast<IntegerType const&>(_type);
4285 solAssert(type.isSigned(), "Expected signed type!");
4286
4287 std::string const functionName = "negate_wrapping_" + _type.identifier();
4288 return m_functionCollector.createFunction(functionName, [&]() {
4289 return Whiskers(R"(
4290 function <functionName>(value) -> ret {
4291 ret := <cleanupFunction>(sub(0, value))
4292 }
4293 )")
4294 ("functionName", functionName)
4295 ("cleanupFunction", cleanupFunction(type))
4296 .render();
4297 });
4298}
4299
4300std::string YulUtilFunctions::zeroValueFunction(Type const& _type, bool _splitFunctionTypes)
4301{

Callers 1

visitMethod · 0.80

Calls 6

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

Tested by

no test coverage detected