| 1357 | } |
| 1358 | |
| 1359 | std::string YulUtilFunctions::extractByteArrayLengthFunction() |
| 1360 | { |
| 1361 | std::string functionName = "extract_byte_array_length"; |
| 1362 | return m_functionCollector.createFunction(functionName, [&]() { |
| 1363 | Whiskers w(R"( |
| 1364 | function <functionName>(data) -> length { |
| 1365 | length := div(data, 2) |
| 1366 | let outOfPlaceEncoding := and(data, 1) |
| 1367 | if iszero(outOfPlaceEncoding) { |
| 1368 | length := and(length, 0x7f) |
| 1369 | } |
| 1370 | |
| 1371 | if eq(outOfPlaceEncoding, lt(length, 32)) { |
| 1372 | <panic>() |
| 1373 | } |
| 1374 | } |
| 1375 | )"); |
| 1376 | w("functionName", functionName); |
| 1377 | w("panic", panicFunction(PanicCode::StorageEncodingError)); |
| 1378 | return w.render(); |
| 1379 | }); |
| 1380 | } |
| 1381 | |
| 1382 | std::string YulUtilFunctions::resizeArrayFunction(ArrayType const& _type) |
| 1383 | { |
no test coverage detected