Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
hensha256 committed Nov 6, 2024
1 parent 2768c3d commit c986b65
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libraries/CalldataDecoder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ library CalldataDecoder {
// shl(5, x) is equivalent to mul(32, x)
let lengthPtr :=
add(_bytes.offset, and(calldataload(add(_bytes.offset, shl(5, _arg))), OFFSET_OR_LENGTH_MASK))
// the number of bytes in the bytes string
length := and(calldataload(lengthPtr), OFFSET_OR_LENGTH_MASK)
// the number of bytes in the bytes string, rounded up to a multiple of 32 bytes
length := add(and(add(calldataload(lengthPtr), 0x1f), OFFSET_OR_LENGTH_MASK_AND_WORD_ALIGN), 0x20)

// the offset where the bytes string begins
let offset := add(lengthPtr, 0x20)
// assign the return parameters
Expand Down

0 comments on commit c986b65

Please sign in to comment.