Skip to content

Commit 5ff607d

Browse files
committed
don't allocate padding space when no padding is needed
1 parent b1646b5 commit 5ff607d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contracts/utils/Base64.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ library Base64 {
8484

8585
// Prepare result pointer, jump over length
8686
let resultPtr := add(result, 0x20)
87+
let resultEnd := add(resultPtr, resultLength)
8788
let dataPtr := data
8889
let endPtr := add(data, mload(data))
8990

@@ -133,7 +134,7 @@ library Base64 {
133134

134135
// Store result length and update FMP to reserve allocated space
135136
mstore(result, resultLength)
136-
mstore(0x40, resultPtr)
137+
mstore(0x40, resultEnd)
137138
}
138139
}
139140

0 commit comments

Comments
 (0)