Update declaration of memory safe assembly blocks (#5172)
This commit is contained in:
@ -134,8 +134,7 @@ library Arrays {
|
||||
* @dev Pointer to the memory location of the first element of `array`.
|
||||
*/
|
||||
function _begin(uint256[] memory array) private pure returns (uint256 ptr) {
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
ptr := add(array, 0x20)
|
||||
}
|
||||
}
|
||||
@ -377,8 +376,7 @@ library Arrays {
|
||||
*/
|
||||
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
|
||||
bytes32 slot;
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
slot := arr.slot
|
||||
}
|
||||
return slot.deriveArray().offset(pos).getAddressSlot();
|
||||
@ -391,8 +389,7 @@ library Arrays {
|
||||
*/
|
||||
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
|
||||
bytes32 slot;
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
slot := arr.slot
|
||||
}
|
||||
return slot.deriveArray().offset(pos).getBytes32Slot();
|
||||
@ -405,8 +402,7 @@ library Arrays {
|
||||
*/
|
||||
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
|
||||
bytes32 slot;
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
slot := arr.slot
|
||||
}
|
||||
return slot.deriveArray().offset(pos).getUint256Slot();
|
||||
@ -451,8 +447,7 @@ library Arrays {
|
||||
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
|
||||
*/
|
||||
function unsafeSetLength(address[] storage array, uint256 len) internal {
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
sstore(array.slot, len)
|
||||
}
|
||||
}
|
||||
@ -463,8 +458,7 @@ library Arrays {
|
||||
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
|
||||
*/
|
||||
function unsafeSetLength(bytes32[] storage array, uint256 len) internal {
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
sstore(array.slot, len)
|
||||
}
|
||||
}
|
||||
@ -475,8 +469,7 @@ library Arrays {
|
||||
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
|
||||
*/
|
||||
function unsafeSetLength(uint256[] storage array, uint256 len) internal {
|
||||
/// @solidity memory-safe-assembly
|
||||
assembly {
|
||||
assembly ("memory-safe") {
|
||||
sstore(array.slot, len)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user