|
|
|
@ -42,12 +42,14 @@ contract GSNContext is Context { |
|
|
|
|
// require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20 |
|
|
|
|
// bytes. This can always be done due to the 32-byte prefix. |
|
|
|
|
|
|
|
|
|
// The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length |
|
|
|
|
// The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the |
|
|
|
|
// easiest/most-efficient way to perform this operation. |
|
|
|
|
|
|
|
|
|
// These fields are not accessible from assembly |
|
|
|
|
bytes memory array = msg.data; |
|
|
|
|
uint256 index = msg.data.length; |
|
|
|
|
|
|
|
|
|
// solhint-disable-next-line no-inline-assembly |
|
|
|
|
assembly { |
|
|
|
|
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. |
|
|
|
|
result := and(mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff) |
|
|
|
|