Memory
Modified from skozin's work for Lido. Switch over to the MCOPY instruction once available - https://eips.ethereum.org/EIPS/eip-5656.
Functions
unsafeAllocateBytes
Allocates a memory byte array of len
bytes without zeroing it out.
Parameters
len
uint256
The length of the byte array to allocate.
memcpy
Performs a memory copy of len
bytes from position src
to position dst
.
Parameters
src
uint256
The source memory position.
dst
uint256
The destination memory position.
len
uint256
The number of bytes to copy.
copyBytes
Copies len
bytes from src
, starting at position srcStart
, into dst
, starting at position dstStart
into dst
.
Parameters
src
bytes
The source bytes array.
dst
bytes
The destination bytes array.
srcStart
uint256
The starting position in src
.
dstStart
uint256
The starting position in dst
.
len
uint256
The number of bytes to copy.
copyBytes
Copies bytes from src
to dst
, starting at position dstStart
into dst
.
Parameters
src
bytes
The source bytes array.
dst
bytes
The destination bytes array.
dstStart
uint256
The starting position in dst
.
Errors
BYTES_ARRAY_OUT_OF_BOUNDS
Thrown when there is an attempt to access an out of bounds array element.
Last updated