| 428 | } |
| 429 | |
| 430 | std::string YulUtilFunctions::shiftLeftFunction(size_t _numBits) |
| 431 | { |
| 432 | solAssert(_numBits < 256, ""); |
| 433 | |
| 434 | std::string functionName = "shift_left_" + std::to_string(_numBits); |
| 435 | return m_functionCollector.createFunction(functionName, [&]() { |
| 436 | return |
| 437 | Whiskers(R"( |
| 438 | function <functionName>(value) -> newValue { |
| 439 | newValue := |
| 440 | <?hasShifts> |
| 441 | shl(<numBits>, value) |
| 442 | <!hasShifts> |
| 443 | mul(value, <multiplier>) |
| 444 | </hasShifts> |
| 445 | } |
| 446 | )") |
| 447 | ("functionName", functionName) |
| 448 | ("numBits", std::to_string(_numBits)) |
| 449 | ("hasShifts", m_evmVersion.hasBitwiseShifting()) |
| 450 | ("multiplier", toCompactHexWithPrefix(u256(1) << _numBits)) |
| 451 | .render(); |
| 452 | }); |
| 453 | } |
| 454 | |
| 455 | std::string YulUtilFunctions::shiftLeftFunctionDynamic() |
| 456 | { |
no test coverage detected