| 3318 | } |
| 3319 | |
| 3320 | std::string YulUtilFunctions::allocateMemoryArrayFunction(ArrayType const& _type) |
| 3321 | { |
| 3322 | std::string functionName = "allocate_memory_array_" + _type.identifier(); |
| 3323 | return m_functionCollector.createFunction(functionName, [&]() { |
| 3324 | return Whiskers(R"( |
| 3325 | function <functionName>(length) -> memPtr { |
| 3326 | let allocSize := <allocSize>(length) |
| 3327 | memPtr := <alloc>(allocSize) |
| 3328 | <?dynamic> |
| 3329 | mstore(memPtr, length) |
| 3330 | </dynamic> |
| 3331 | } |
| 3332 | )") |
| 3333 | ("functionName", functionName) |
| 3334 | ("alloc", allocationFunction()) |
| 3335 | ("allocSize", arrayAllocationSizeFunction(_type)) |
| 3336 | ("dynamic", _type.isDynamicallySized()) |
| 3337 | .render(); |
| 3338 | }); |
| 3339 | } |
| 3340 | |
| 3341 | std::string YulUtilFunctions::allocateAndInitializeMemoryArrayFunction(ArrayType const& _type) |
| 3342 | { |
no test coverage detected