Revert "Adds `memory-safe` tag to assembly sections in `BytesLib`."
This reverts commit 2cbbf25d74
.
This commit is contained in:
parent
b803184a8d
commit
785ba82080
|
@ -12,7 +12,7 @@ library BytesLib {
|
|||
function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) {
|
||||
bytes memory tempBytes;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
// Get a location of some free memory and store it in tempBytes as
|
||||
// Solidity does for memory variables.
|
||||
tempBytes := mload(0x40)
|
||||
|
@ -80,7 +80,7 @@ library BytesLib {
|
|||
}
|
||||
|
||||
function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
// Read the first 32 bytes of _preBytes storage, which is the length
|
||||
// of the array. (We don't need to use the offset into the slot
|
||||
// because arrays use the entire slot.)
|
||||
|
@ -215,7 +215,7 @@ library BytesLib {
|
|||
|
||||
bytes memory tempBytes;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
switch iszero(_length)
|
||||
case 0 {
|
||||
// Get a location of some free memory and store it in tempBytes as
|
||||
|
@ -272,7 +272,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
|
||||
address tempAddress;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 1, "toUint8_outOfBounds");
|
||||
uint8 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0x1), _start))
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
|
||||
uint16 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0x2), _start))
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
|
||||
uint32 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0x4), _start))
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
|
||||
uint64 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0x8), _start))
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
|
||||
uint96 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0xc), _start))
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
|
||||
uint128 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0x10), _start))
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
|
||||
uint256 tempUint;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempUint := mload(add(add(_bytes, 0x20), _start))
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ library BytesLib {
|
|||
require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
|
||||
bytes32 tempBytes32;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
tempBytes32 := mload(add(add(_bytes, 0x20), _start))
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ library BytesLib {
|
|||
function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
|
||||
bool success = true;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
let length := mload(_preBytes)
|
||||
|
||||
// if lengths don't match the arrays are not equal
|
||||
|
@ -412,7 +412,7 @@ library BytesLib {
|
|||
function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {
|
||||
bool success = true;
|
||||
|
||||
assembly ("memory-safe") {
|
||||
assembly {
|
||||
// we know _preBytes_offset is 0
|
||||
let fslot := sload(_preBytes.slot)
|
||||
// Decode the length of the stored array like in concatStorage().
|
||||
|
|
Loading…
Reference in New Issue